I have a question about the webBrowser control.
It does work good to display webpages but it seems that the control have problem to
display certain webpages. (I think it has to do with javascript on the webpage).

When trying to display this webpage, it will not FULLY load everything on the webpage.

  • Trying to open the webpage in IE8 gets the same problem.
  • Trying to open the webpage in CHROME does work!

I wonder if we can modify anything for the webBrowser1 to make this work?


Try adding the following: this.webBrowser1.ScriptErrorsSuppressed = true;

Thanks, that line will only Ignore the error.
The thing is that I need to show the whole page which doesn´t work.

When entering the URL, I get below error, so it has to do with scripts as I understand but dont know how to solve?

"Object doesn´t suport this property or method. Do you want to continue running scripts on this page"

I can't remember if the webbrowser control supports javascript. The other issue could be with cookies.

Here's some stuff I've used:

using System.Runtime.InteropServices;
using Microsoft.Win32;
using mshtml; //internet - Reference => .NET = Microsoft.mshtml
using SHDocVw; //internet - Reference => COM  => Microsoft Internet Control
using System.Net; //HttpWebRequest, HttpWebResponse
using System.Security.Cryptography;

//It works with websites that have HTTPONLY set for cookies.
//it is necessary to use SHDocVw for this though, as   
//doesn't seem to work as desired. 

//make a commom instance of WebBrowser
public SHDocVw.InternetExplorer myWebBrowser = new SHDocVw.InternetExplorer(); 

//used to pass cookies from myWebBrowser
private System.Net.CookieContainer cookies = new System.Net.CookieContainer();

// used to get HTTPONLY cookies 
const int INTERNET_COOKIE_HTTPONLY = 0x00002000;

[DllImport("wininet.dll", CharSet = CharSet.Auto, SetLastError = true)]
static extern bool InternetGetCookieEx(string pchURL, string pchCookieName, StringBuilder pchCookieData, ref uint pcchCookieData, int dwFlags, IntPtr lpReserved);

Then you can use the following in the documentComplete event:

//set htmlData
HTMLDocument doc = (mshtml.HTMLDocument)myWebBrowser.Document;
string htmlData = doc.body.outerHTML;

Here is setting cookies in the NavigateComplete2 event:

private void myWebBrowser_NavigateComplete2(object sender, ref object URL)

    //Console.WriteLine("Navigate complete: " + URL.ToString());
    mshtml.IHTMLDocument2 HTMLDocument = (mshtml.IHTMLDocument2)myWebBrowser.Document;

        //add cookies to cookie container
        this.cookies.SetCookies(new Uri(URL.ToString()), HTMLDocument.cookie);
    catch (Exception ex)
        Console.WriteLine("ERROR: WebSHDocVw::myWebBrowser_Navigating (SetCookies): " + ex.Message);

        //add readonly cookies to cookie container
        this.cookies.SetCookies(new Uri(URL.ToString()), this.GetGlobalCookies(URL.ToString()));
    catch (Exception ex)
        Console.WriteLine("ERROR: WebSHDocVw::myWebBrowser_Navigating (SetCookies - Global): " + ex.Message);

The web browser control is based on Internet Explorer. If the web page doesn't work in IE, it won't work in your WebControl either.

Okay, is there any work around fix to make it work for the WebControl or is it impossible with this control?

You could try and use WebKit.NET. This will attempt to use the same browser component that is used in Safari.

Other than that, there is the Chromium Embedded Framework, but I've found this difficult to use and produces unpredictable results (do not expect Google Chrome and Chromium to give the same output...)

I have checked the webcontrol with the webpage i have developed, it doesnt fully loaded in webcontrol, but it does in IE. I have got script errors while loading webcontrol from visual studio- "object doesnt support property or method". But when i load the same url in IE it loaded without any error.
I couldnt sort out the issue, pls help me out.