5

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.

Macko Tarana
  • 175
  • 11
  • try to enable it from tools -> developer tools -> there you will see a tab with name ie 11 click on that and change it to ie 8 or ie7 what you want – Faizan Khan Nov 29 '13 at 11:25
  • I set these tabs before i wrote this: `document mode` and `user agent string`. Tags are still ignored. – Macko Tarana Nov 29 '13 at 11:30
  • "*Browser stack... I'd prefer client than remote access.*" ... you can download the relevant VM images for each IE version for yourself from http://modern.ie/ Then you can run the VMs on your local PC. That said, I really like Browser Stack; it's easy and convenient, and saves the hassle of setting up the VM for yourself. – Spudley Nov 29 '13 at 11:36
  • For ref: `Document Mode` is the one that should work here. `User Agent String` does not change the browser's mode; it just changes how it identifies itself to the server. – Spudley Nov 29 '13 at 11:37
  • 1
    And finally, for detection of old browsers, you might want to consider using [Modernizr](http://modernizr.com/). This is a relatively lightweight script, as you asked for. It's aim is to detect *features* rather than the actual browser, which means you can target browsers that support the features you're using without having to actually know what the browser is. This is considered better practice than detecting the browser itself. – Spudley Nov 29 '13 at 11:38
  • conditional statements were completely removed from IE 11, they are always ignored as far too many sites give IE poor CSS and this was yet another way to fight all the stupid browser sniffing going on out there. It is always best to do feature detection 1st. – Chris Love Nov 29 '13 at 22:05

2 Answers2

4

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

Wagner_SOFC
  • 117
  • 4
  • I can't post more than 2 links by message for now. So, I post the suite source here : [An other thread on stackoverflow.com](http://stackoverflow.com/questions/19446584/why-doesnt-ie11-honour-conditional-comments-even-when-emulating-ie8-document-mo) [Issue report on microsoft.com](https://connect.microsoft.com/IE/feedback/details/806767/conditional-comments-do-not-work-when-emulating-document-modes-via-f12-developer-tools) – Wagner_SOFC Nov 30 '13 at 00:46
3

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.

rand'Chris
  • 788
  • 4
  • 17