none
JavaScript error using the WebBrowser control ion VB.Net.

    Question

  • I am developing an Outlook 2007 VSTO application that works with a commercial website.  Almost all of the app's interactions with the website are done using HttpRequest objects.  One user scenario does require the app to open a browser to a specific page on the site, and that page requires a Post string to provide the results of a form submit.  I am using the version of the WebBrowser control that ships with VS 2008, and specifically VB.Net.  My code successfully goes to the first page, after which it navigates to the actual target page (once the first page is loaded).  That works, too, but if I click on the desired link on the target page, a JavaScript error pops up, stating "'j.parentNode' is not an object", with a Code of 0.  I do not have access t the commerical site's internals.  The page and links in question, when accessed via IE or Firefox, work correctly without the JavaScript error.  The page containing the link is using Flex.

    Is this a problem with the nWebBrowser control?  Has anyone else experienced this problem?  Is there a fix?

    Thanks!
    John
    NLBW
    Saturday, January 23, 2010 12:43 AM

Answers

  • If you double-click that yellow icon in IE, it should give you a window with the error description. Yet, to get your project going, use the following (where 'Webbrowser1' needs to be replaced with your webbrowser control's name:

    WebBrowser1.ScriptErrorsSuppressed = True

    You could put the above line of code in the FormLoading Sub, so, errors will be surpressed right from the beginning after you start your application.
    Listing SPEC's is not a review !!! :-)
    • Proposed as answer by Chao KuoModerator Tuesday, January 26, 2010 7:51 AM
    • Marked as answer by John Gay Tuesday, January 26, 2010 4:08 PM
    Saturday, January 23, 2010 6:13 PM

All replies

  • I believe, you still get the same error in IE7/IE8. If you navigate to that site with IE, pay attention to the lower left corner (StatusBar) - you most likely will see a yellow icon. If you click on that icon, you will see the same JavaScript error.

    There is a way of supressing such error messages in the webbrowser control. I am just not on my development computer right now, so, I can't look it up for you.
    Listing SPEC's is not a review !!! :-)
    Saturday, January 23, 2010 12:53 AM
  • Earl Tut,

    Thanks for your quick - and encouraging - reply.  I went to the commercial site and ran the navigation and, sure enough, the yellow icon does appear.  For some reason clicking on it didn't bring up the error message, but I will assume for the moment that it's the JavaScript error.  I've been tryng to find out how to suppress those error messages in the WebBrowser control but have not found it yet.  If you do in fact have that info, I will be most grateful to receive it from you!

    John
    NLBW
    Saturday, January 23, 2010 5:36 PM
  • If you double-click that yellow icon in IE, it should give you a window with the error description. Yet, to get your project going, use the following (where 'Webbrowser1' needs to be replaced with your webbrowser control's name:

    WebBrowser1.ScriptErrorsSuppressed = True

    You could put the above line of code in the FormLoading Sub, so, errors will be surpressed right from the beginning after you start your application.
    Listing SPEC's is not a review !!! :-)
    • Proposed as answer by Chao KuoModerator Tuesday, January 26, 2010 7:51 AM
    • Marked as answer by John Gay Tuesday, January 26, 2010 4:08 PM
    Saturday, January 23, 2010 6:13 PM
  • Earl Tut,

    Thank you so much for the info.  I will try this out soon and post back the results.

    John
    NLBW
    Saturday, January 23, 2010 6:35 PM
  • John Gay said:
    Earl Tut,

    Thank you so much for the info.  I will try this out soon and post back the results.

    John
    NLBW

    LOL, don't thank me! It was Microsoft building it right into the WebBrowser Control / Class ... ! :-)
    Listing SPEC's is not a review !!! :-)
    Saturday, January 23, 2010 6:40 PM
  • Earl Tut's suggestion worked perfectly!
    NLBW
    Tuesday, January 26, 2010 4:09 PM
  • Earl Tut's suggestion worked perfectly!
    NLBW
    Tuesday, January 26, 2010 4:09 PM
  • Hello,

     

    Considering that many developers in this forum ask how to manipulate WebBrowser component (suppressing error messages), my team has created a code sample for this frequently asked programming task in Microsoft All-In-One Code Framework. You can download the code samples at:

     

    VBWebBrowserSuppressError

     

    http://bit.ly/VBWebBrowserSuppressError

     

    CSWebBrowserSuppressError

     

    http://bit.ly/CSWebBrowserSuppressError

     

    With these code samples, we hope to reduce developers’ efforts in solving the frequently asked

    programming tasks. If you have any feedback or suggestions for the code samples, please email us: onecode@microsoft.com.

    ------------

    The Microsoft All-In-One Code Framework (http://1code.codeplex.com) is a free, centralized code sample library driven by developers' needs. Our goal is to provide typical code samples for all Microsoft development technologies, and reduce developers' efforts in solving typical programming tasks.

    Our team listens to developers’ pains in MSDN forums, social media and various developer communities. We write code samples based on developers’ frequently asked programming tasks, and allow developers to download them with a short code sample publishing cycle. Additionally, our team offers a free code sample request service. This service is a proactive way for our developer community to obtain code samples for certain programming tasks directly from Microsoft.

    Thanks

    Microsoft All-In-One Code Framework

     

     

    Friday, March 25, 2011 3:28 AM