本文介绍了一个默认的搜索查询C#启动默认浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要做的是用默认搜索启动默认浏览器。默认的搜索是当你键入网址导航文本框中搜索条件会发生什么。例如,在Chrome和Firefox,默认情况下,键入小狗进入导航文本框将带领您到谷歌结果的小狗。

What I need to do is launch the default browser with a default search. The default search is what happens when you type search terms in the URL navigation text box. For example, in Chrome and Firefox, by default, typing "puppies" into the nav text box will lead you to the Google results for "puppies". In IE, it will do the same thing, just on Bing.

通常情况下,你可以通过做一些像调用默认浏览器b

Normally, you can invoke the default browser just by doing something like:

Process.Start("http://google.com");



但我不能假设默认的搜索服务提供商是谷歌。

But I can't assume the default search provider is Google.

有没有办法来调用通过C#这种行为?我可以计算做的唯一一件事就是试图确定哪个浏览器是默认,然后直接与搜索项执行它。

Is there a way to invoke this behavior via C#? The only thing I can figure to do is to try and determine which browser is the default and then execute it directly with the search terms.

任何人都知道任何其他的(最好更简单)的方式

Anyone know of any other (preferably easier) way?

更新:
刚刚发现代码中查找默认浏览器的。

推荐答案

如果你已经知道如何找到默认的浏览器,我会尝试使用的Process.Start( browser\path.exe,\searchterm\);

If you already know how to find the default browser, I would try using Process.Start("browser\path.exe", "\"? searchterm\"");

这似乎是为IE浏览器和Chrome。

This seems to work for both IE and Chrome.

这篇关于一个默认的搜索查询C#启动默认浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 03:07