简体   繁体   中英

IE 11 - developer tools and detecting old IE browsers

I'm using IE11 now, I thought it would be nice to have some additional tools for web developing. I was always using these tags to detect old crappy IE browsers:

<!--[if lt IE 7]><html class="ie ie6 some-custom-class"><![endif]-->
<!--[if IE 7]><html class="ie ie7 some-custom-class"><![endif]-->
<!--[if IE 8]><html class="ie ie8 some-custom-class"><![endif]-->
<!--[if IE 9]><html class="ie ie9 some-custom-class"><![endif]-->
<!--[if gt IE 9]><html class="ie some-custom-class"><![endif]-->
<!--[if !IE]><!--><html class="some-custom-class"><!--<![endif]-->

I set IE11 to IE8-9 compatibility but it ignores the above tags. If there's no way to turn them ON then i don't understand why they made these tools -.-' Where is the logic ?

Anyway do I need to install win 7 only for IE 8-9 ?

http://www.browserstack.com < - I'd prefer client than remote access.

Is there something like patch for this "modern" browser to make developer tools usable ?

Or maybe there is another way to detect old browsers with a really lightweight script.

Conditional statements has been removed since IE10. But the developer tools of this version of IE still able to interprete them. Nevertheless, it isn't the case for the version of IE11. I don't know if it's possible to make back this feature. I guess no, anyway not for now I'm afraid. For me too, it's not logical. The emulation should support conditional statements. So, I think Microsoft will make a fix for that one day.

For the previous version of IE, you can install Windows 7 or use a WM. Make your own choice.

I confirm, that's right, you can use Modernizr to detect the browser.


Source : Conditional statements support by IE 11 and IE 10 Developer Tool
Support conditional comments by IE

The easiest and simplest way I've found is to play with this tag in the HTML:

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"

If you set the IE11 render mode to '8' and set the above to content="IE=8" you'll get a browser version that respects the conditional comments. I only use this for lightweight testing of CSS positioning, etc. It's still an inconvenience but it's not as bad as needing a half-dozen VMs.

I see @Lonard actually has this solution in the second link posted, but doesn't mention it in the answer. Unfortunately, "removing the dependency", which is the typical answer, isn't a solution when you have clients that insist your pages work in IE7 and IE7 doesn't understand what is now very basic CSS layout.

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