Is there a way in .NET to have a Process open the default web browser with no address bar and no tabs, WITHOUT using kiosk mode? I can't use the WebBrowser object because it uses IE7, and the pages that need to be opened use JavaScript. I can't use kiosk mode because the client needs the window to appear in a specific area of the screen. I also need to maintain access to the browser because I have to know when the page is closed.
Asked
Active
Viewed 4,451 times
3
-
3The webbrowser control isn't IE7. It's a wrapper around whatever version of IE the user has installed on their machine. A webpage should be rendered correctly if you specify in the page you are rendering. – Leon Bambrick Apr 09 '14 at 04:47
-
That's encouraging. However, it's completely contradictory to everything else I've seen on any other forum. I've seen lots of forum answers saying it only uses IE7 unless you're running Windows 8, in which case it runs IE10. Can you provide a source please? – KairisCharm Apr 09 '14 at 12:18
-
Read comments here http://weblog.west-wind.com/posts/2011/May/21/Web-Browser-Control-Specifying-the-IE-Version and answers here http://stackoverflow.com/questions/3393632/wpf-net4-webbrowser-and-internet-explorer-8#answer-10539827 and here http://stackoverflow.com/a/13451381/49 – Leon Bambrick Apr 09 '14 at 22:13
2 Answers
6
Try this:
dynamic ie = Activator.CreateInstance(Type.GetTypeFromProgID("InternetExplorer.Application"));
ie.AddressBar = false;
ie.MenuBar = false;
ie.ToolBar = false;
ie.Visible = true;
ie.Navigate("www.google.com");
This uses automation to achieve what you want.
You can also set the position, add event handlers, etc.
The documentation for this interface is here.

Baldrick
- 11,712
- 2
- 31
- 35
-
Your code works great, and I am able to set the window bounds, however, I cannot set the OnQuit event. It throws an exception saying "'System.__ComObject' does not contain a definition for 'OnQuit'", so clearly it's not coming across as an InternetExplorer object. – KairisCharm Apr 09 '14 at 14:17
-
Never mind. I figured it out. I had to include the COM reference "Microsoft Internet Controls", then set the event with: ((SHDocVw.InternetExplorer)ie).OnQuit += ExplorerClosed; If you'd add this line to your code, I'll gladly mark it as an answer! ^_^ – KairisCharm Apr 09 '14 at 14:31
1
If you want to acheive browser automation then you should use Selenium webdriver

Ishtiaq
- 980
- 2
- 6
- 21