Hi all.

I am currently writing an application that uses the WebBrowser control to perform operations on web pages.Unfortunately I stumbled upon a very annoying problem, sometimes an Internet explorer script error window pops up and stops all execution until you click the OK button.I’ve searched the web for hours and the same answer came up:it’s easy (so easy, yeah…) just do this:

WebBrowser.Silent = true;the problem is that WebBrowser does not have a property named silent!!!!!! Maybe it did, but no more! if you don’t believe me take a a look at the MSDN.What you should do is use (which I have missed when i looked in the MSDN… )

WebBrowser.ScriptErrorsSuppressed = true;

which does exists…

Hope this helps some frustrated people (like me).

Happy holidays

Amit

Tags :

16 Responses to “How to Suppress / Disable Script Errors in WebBrowser Control”


  1. Hoq

    Said on April 28, 2008 :

    Wanted to thank you for this post – I’m not sure when “Silent” went away, but it was driving me nucking futs!

  2. Zeonz

    Said on May 15, 2008 :

    I use the WebBrowser.ScriptErrorsSuppressed = true;

    give me other debugging error … anyway to cancel the debugging error too?

  3. uncleboob

    Said on September 15, 2008 :

    I like to have an answer too. Thanks in advance.

  4. Amit

    Said on September 16, 2008 :

    @ uncleboob

    What error are you getting?

  5. Mr Scriptoid

    Said on November 6, 2008 :

    Class effort thanks!!

  6. Boer

    Said on March 4, 2009 :

    ScriptErrorsSuppressed id now missing(((

  7. Billie

    Said on January 6, 2010 :

    I’ll try it right now !
    xD

  8. oscar

    Said on April 27, 2010 :

    Useful for me too! Thank you Amit

  9. Ortega

    Said on June 11, 2010 :

    Writing an SL4 app w/ an embedded WebControl that needs to suppress errors. Yes, the WebControl.ScriptErrorsSuppressed and WebControl.Silent properties are no longer available. Yikes!? What now?

  10. Gian Maria

    Said on August 31, 2010 :

    For Wpf WebBrowser control you can try a javascript injection technique. This worked for me :)

    http://www.codewrecks.com/blog/index.php/2010/08/31/disable-javascript-error-in-wpf-webbrowser-control/

  11. Nail

    Said on September 27, 2010 :

    Where do you insert the code? I am trying it but cannot get it work.

  12. Allen George

    Said on March 1, 2011 :

    Nail,

    You can insert the code right after you instantiate your web browser object. In my program I placed this “webcontrol.ScriptErrorsSuppressed = true;” in my onformload method.

  13. Marcelo

    Said on May 23, 2011 :

    Thanks you Amit! You save me =]

  14. bobi

    Said on September 21, 2011 :

    wow thanks !

2 Trackback(s)

  1. Mar 15, 2008: My Blog Stats - February 2008 | Dev102.com
  2. Apr 2, 2014: How to Suppress / Disable Script Errors in WPF WebBrowser Control | Dev102.com

Post a Comment