Question

If I use IE I can visit the website I want and click the 'Next' button and life is good. If I open that same website using the webBrowser control and click the 'Next button I get a javascript error message.

I'm not doing anything in the code to manipulate the website. My goal, eventually, is to have some level of automation; but at this point, I get the javascript error and a pop-up and it screws everything else.

I can hide the JS error from popping up; by setting 'WebBrowser1.ScriptErrorsSuppressed = True' but the page isn't working because of the error.

Was it helpful?

Solution

The client script might be assuming a full browser is present and trying to access part of the browser outside the Document Object Model (DOM) of the page. For example, maybe the client script is trying to display something on the browser's status bar, or trying to modify a toolbar which isn't available in the WebBrowserControl. There could be numerous similar reasons.

If you do not have write-access to the web page in question to try fixing it, then play with WebBrowser Control properties such as ScriptErrorsSuppressed and ObjectForScripting

OTHER TIPS

Try setting WebBrowser1 Silent property to true.

Actually, you are receiving this problem because when you run your site in IE8 or IE9 on your normal internet explorer desktop app, you are getting either IE8 or IE( rendering, depending on which you have installed. However, with the webbrowser control, unless you take the effort to change soem settings in the registry, the default rendering engine used by the webbrowser control is IE7 (if u have 7, 8 or 9 installed) and IE4 (if you have 4, 5 or 6 installed).

This is why you are having the problem, if you want help changing the rendering engine version for your webbrowser control, do a google search as there are many examples on SO, and i have provided this answer in some of my previous posts on this tag/topic. feel free to search or ask me.

Let me know how you go.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top