Matthew Gribben
Matthew Gribben

Reputation:

.NET WebBrowser control javascript

Does anybody know if there is some sort of bug or issue with the webBrowser activex control in .NET applications, in this case the embedded browser loads a web page that depends on javascript to play music previews. It works once but if you navigate to a new page in the system it stops working.

Viewing the same site in just a normal IE browser results in no errors at all (tested on several systems of various types).


It happens on several different OS's, XP 32 and 64 bit, Vista, Windows 7.

Its also not a java applet, just jQuery and the longtail video player with some JS to bind a preview link to the player. Im very confused as to why it works sometimes but not others.

Its also a large live system and getting lots of complaints.

Upvotes: 0

Views: 2827

Answers (3)

Erx_VB.NExT.Coder
Erx_VB.NExT.Coder

Reputation: 4856

Let me tell you this straight up. The default rendering engine on the WebBrowser control is fixed to ensure compatibility across all platforms.

Basically, if your installed browser is IE 7 - IE 9, then the rendering engine used is IE 7.0 only (by default).

If, however, your installed IE version is IE 6 or below, then the rendering engine used is IE 4.0, unless of course you set it otherwise.

There is a misconception that WebBrowser control uses whatever is currently installed (current IE version) but this is not true, since they do this to reduce backward compatibility issues. You can see (as proof) that this really is your problem by going to http://www.whatsmyuseragent.com in your normal browser, and then going to that website again in your WebBrowser control, you will see that it says MSIE 7.0 :).

I suspect your users (and you) who are on IE 6.0 would be experiencing the problems you've alluded to since their rendering engine being used is IE 4.0 (and IE 7 if they are running anything between IE 7 to IE9). This is really bad, especially if they are on IE 6, you should ask them to upgrade their browser if they are IE 6, then, IE 7.0 will be used regardless.

I'm not sure if, when IE 10.0 comes out, the WebBrowser control's default engine will go to 10.0 (if 10.0 is installed on system of course) or if it will remain as IE 7.0 even after IE 10.0 is released, we will have to see once it comes out. However, if we guess based on previous experience, I suspect IE 10.0 will be the last version that uses IE 7.0 rendering engine, and when IE 11 comes out, the default rendering engine will remain as IE 11 for all versions of IE between IE 11 & IE 14. This is just a guess by extrapolating what they've done in the past.

You can set the WebBrowser control to use the current installed version of Internet Explorer; if you want more information on how to do this, or how to further fix the rendering engine, let me know and I'll help you out with it.

Upvotes: 4

Fenton
Fenton

Reputation: 251192

The web browser control uses the same shell as the installed version of Internet Explorer, but in my experience, the full browser handles things more gracefully.

It is worth adding some debug to the JavaScript to see where the problem is - is it because longtail isn't registering as loaded, so no events are binding or is it because of a problem with the events.

Upvotes: 0

Pat
Pat

Reputation: 5282

Which version of .net are you using?

Also which OS?

Ive noticed within Vista that Java applets <applet> tags causes catastrophic issues. I believe this is due to it using Microsoft JVM for its java processing, which happens to be unsupported now. This does not occur in XP from what ive seen

Upvotes: 0

Related Questions