简体   繁体   中英

Force WebBrowser to use IE9

Is there any way to force the WebBrowser control to use IE9? The primary reason for this is because JS scripts refuse to execute properly when I navigate to a certain site.

3you can get IE9 preview by downloading it from Microsoft's site: http://ie.microsoft.com/testdrive/

Secondly, parseInt($.browser.version) > 9 would presumably check that the version is greater than 9, which of course it won't be until v10 is released. (you maybe intended >= ('greater than or equal to')?

I usually tell people to avoid browser detection or browser-specific code. There are times when it is necessary, but they're quite rare. Most of the time the developer would be better served by knowing what was failing and working around it (tools like Modernizr really help for this sort of thing).

However there are times when one simply has to do browser detection.

In your case, if you really need to detect IE, don't do it the way you're doing (ie checking for version 9); it'd be better to check for older versions, and I'd suggest that a conditional comment would be the best way to do it.

<script> var i_am_old_ie = false; <!--[if LT IE 9]> i_am_old_ie = true; <![endif]--> </script> <script> var i_am_old_ie = false; <!--[if LT IE 9]> i_am_old_ie = true; <![endif]--> </script> Then your if() statement later on can just look like this:

if(i_am_old_ie) {    //do stuff for IE6/7/8 } else {    //do stuff for all other browsers (including IE9) }  

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM