简体   繁体   English

如何在C#中启动精简浏览器?

[英]How to launch a reduced browser in c#?

I need to launch a browser to example: "http://www.abc.com" with c#. 我需要使用c#启动一个浏览器,例如:“ http://www.abc.com”。

The thing is, I don't want all those "Go Back", "add new tab", "search box", or "toolbar" appear on the launched browser, and I need a smaller browser, not maximized one. 问题是,我不希望所有这些“返回”,“添加新标签”,“搜索框”或“工具栏”出现在启动的浏览器中,而我需要一个较小的浏览器,而不是最大化的浏览器。

How to achieve it in C#? 如何在C#中实现?

currently I am using System.Diagnostics.Process.Start(url); 当前我正在使用System.Diagnostics.Process.Start(url);

Thanks. 谢谢。

From within a web page, you can use Javascript's window.open function to do this. 在网页中,您可以使用Javascript的window.open函数来执行此操作。

http://www.javascript-coder.com/window-popup/javascript-window-open.phtml http://www.javascript-coder.com/window-popup/javascript-window-open.phtml

For your situation, you have two options, neither is perfect. 对于您的情况,您有两个选择,都不是完美的选择。

  1. Create a WinForms app with a WebBrowser control and only the controls you need and launch that. 创建一个带有WebBrowser控件以及仅所需控件的WinForms应用,然后启动它。 (Sort of a "dumbed down"browser) (排序“浏览器”浏览器)

  2. Actually launch a browser to a page you've set up. 实际启动浏览器到您设置的页面。 This page would have a javascript call to open a new window, and then close itself. 此页面将使用javascript调用来打开新窗口,然后自行关闭。

Option 2 is not likely to work, and more likely than not, your end users will ahve pop-ups disabled. 选项2不太可能起作用,最终用户很有可能会禁用弹出式窗口。 Option 1 will work, giving you full control over the UI, and what buttons you want, but it's not launching the default browser, and it means you have to put the "dumbed down browser" app on your client's PC. 选项1将起作用,使您可以完全控制UI以及所需的按钮,但它不会启动默认浏览器,这意味着您必须将“虚拟浏览器”应用程序放在客户端的PC上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM