Questions tagged [webbrowser-control]

This tag refers to the WebBrowser ActiveX Control (native) and for Windows Forms or WPF applications (.NET). This control "hosts Web pages and provides Web browsing capabilities to your application".

This tag refers to:

According to "WebBrowser Control Overview":

The WebBrowser control provides a managed wrapper for the WebBrowser ActiveX control. The managed wrapper lets you display Web pages in your Windows Forms client applications. You can use the WebBrowser control to duplicate Internet Explorer Web browsing functionality in your application or you can disable default Internet Explorer functionality and use the control as a simple HTML document viewer. You can also use the control to add DHTML-based user interface elements to your form and hide the fact that they are hosted in the WebBrowser control. This approach lets you seamlessly combine Web controls with Windows Forms controls in a single application.

Note that, by hosting the ActiveX WebBrowser control, a Windows Desktop application is effectively re-using the Internet Explorer COM components. As a result, upgrading Internet Explorer on a computer also upgrades all uses of the WebBrowser control on that computer.

Code samples:

Resources:

4752 questions
477
votes
8 answers

Replacing .NET WebBrowser control with a better browser, like Chrome?

Is there any relatively easy way to insert a modern browser into a .NET application? As far as I understand, the WebBrowser control is a wrapper for IE, which wouldn't be a problem except that it looks like it is a very old version of IE, with all…
Sylverdrag
  • 8,898
  • 5
  • 37
  • 54
195
votes
9 answers

How do I open a web browser (URL) from my Flutter code?

I am building a Flutter app, and I'd like to open a URL into a web browser or browser window (in response to a button tap). How can I do this?
Seth Ladd
  • 112,095
  • 66
  • 196
  • 279
171
votes
8 answers

Options for embedding Chromium instead of IE WebBrowser control with WPF/C#

Updated for 2020, I've linked my article where I compare the memory footprints of different approaches to hosting HTML WebView in a basic Windows Desktop application: MSEdge WebView2 WPF Chromely/CefSharp Electron v10 Legacy IE11 WebBrowser…
noseratio
  • 59,932
  • 34
  • 208
  • 486
109
votes
7 answers

Disable JavaScript error in WebBrowser control

I am developing a windows application with a WebBrowser control that navigates to a sharepoint site. My problem is that i am getting JavaScript error. How can i disable the JavaScript error? I don't want them to pop up.
Gaby
  • 2,923
  • 4
  • 38
  • 52
96
votes
14 answers

Use latest version of Internet Explorer in the webbrowser control

The default version of the webbrowser control in a C# Windows Forms application is 7. I have changed to 9 by the article Browser Emulation, but how is it possible to use the latest version of the installed Internet Explorer in a webbrowser control?
Moslem7026
  • 3,290
  • 6
  • 40
  • 51
85
votes
12 answers

Will the IE9 WebBrowser Control Support all of IE9's features, including SVG?

I recently upgraded to IE9-beta. Now, In my .Net (3.5) WinForm application I want to use WebBrowser control. So my question is, whether the WebBrowser control will exhibit all properties and functions of IE9? My concern is, I want to render some…
Omkar
  • 2,129
  • 8
  • 33
  • 59
83
votes
16 answers

How to inject Javascript in WebBrowser control?

I've tried this: string newScript = textBox1.Text; HtmlElement head = browserCtrl.Document.GetElementsByTagName("head")[0]; HtmlElement scriptEl = browserCtrl.Document.CreateElement("script"); lblStatus.Text =…
jsight
  • 27,819
  • 25
  • 107
  • 140
69
votes
1 answer

Displaying html from string in WPF WebBrowser control

My data context object contains a string property that returns html that I need to display in WebBrowser control; I can't find any properties of WebBrowser to bind it to. Any ideas? Thanks!
Andrey
  • 20,487
  • 26
  • 108
  • 176
66
votes
9 answers

Load local HTML file in a C# WebBrowser

In my app I have a WebBrowser element. I would like to load a local file in it. I have some questions: Where to place the HTML file (so that it will also be installed if a user executes the setup) how to reference the file? (e.g. my guess is the…
PeeHaa
  • 71,436
  • 58
  • 190
  • 262
65
votes
10 answers

WPF WebBrowser control - how to suppress script errors?

I found a similar question here: How do I suppress script errors when using the WPF WebBrowser control? But non of those solutions work for me. I need to stop the popups from appearing as i am using the WebBrowser to automate admin tasks on a…
DrLazer
  • 2,805
  • 3
  • 41
  • 52
63
votes
9 answers

Detect WebBrowser complete page loading

How can I detect when a System.Windows.Forms.WebBrowser control has completed loading? I tried to use the Navigate and DocumentCompleted events but both of them were raised a few times during document loading!
Neir0
  • 12,849
  • 28
  • 83
  • 139
60
votes
6 answers

Difference between F5, Ctrl + F5 and click on refresh button?

I have often experienced while developing my web applications that pressing F5 or refresh doesn't produce or refresh the proper result. But when we hit Ctrl + F5 it generates the correct result. What is the basic difference between simple F5 and…
Awais Qarni
  • 17,492
  • 24
  • 75
  • 137
59
votes
9 answers

How to get around the memory leak in the .NET Webbrowser control?

This is a widely-known, old issue with the .NET Webbrowser control. Summary: Having the .NET webbrowser control Navigate to a page increases memory usage that is never freed. Reproduce the memory leak: Add a WebBrowser control to a form. Use it to…
Azuvector
  • 901
  • 2
  • 7
  • 13
52
votes
7 answers

Add new Microsoft Edge to web browser control?

The new Windows 10 with Microsoft Edge has arrived. How can I add it to my web browser control? I need it because the actual web browser control doesn't allow JavaScript and CSS3. I used to also add Chrome browser with the projects WebKit and…
Nico
  • 521
  • 1
  • 4
  • 3
50
votes
4 answers

Changing the user agent of the WebBrowser control

I am trying to change the UserAgent of the WebBrowser control in a Winforms application. I have successfully achieved this by using the following code: [DllImport("urlmon.dll", CharSet = CharSet.Ansi)] private static extern int…
Proximo
  • 6,235
  • 11
  • 49
  • 67
1
2 3
99 100