0

I have a particular need where I must cater for IE9. So in my main document in the head section I have:

 <!--[if IE 9]>
    <link rel="stylesheet" href="css/IE9pc.css"  media="screen and (min-width: 1348px)"/>
    <link rel="stylesheet" href="css/IE9tablet.css" media="screen and (min-width: 767px) and (max-width: 1347px)" />
    <link rel="stylesheet" href="css/IE9mobile.css"  media="screen and (max-width: 767px)" />
<![endif]-->

This works fine if the window is already at the sizes specified, but If I reduce or expand the screen size, then the appropriate stylesheet for the new screen size doesn't kick in. How can I get the correct stylesheet to be picked up dynamically?

Update

I See Rory has marked this as duplicate, but it's not. In my case as per Rory's direction, compatibility view isn't set this is testing against a 'true' I.E.9. browser. An answer offered by the Rory's link suggested <meta http-equiv="X-UA-Compatible" content="IE=9"> but because I'm catering for newer browsers as well I have <meta http-equiv="X-UA-Compatible" content="IE=edge"> in my header and I don't believe I can change this easily in code.

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
bilpor
  • 3,467
  • 6
  • 32
  • 77
  • 1
    IE9 for mobile ... Did that really exist? – Teemu Sep 20 '18 at 10:14
  • 1
    @Teemu sadly, yes, on Windows phones https://en.wikipedia.org/wiki/Internet_Explorer_Mobile#Version_9. I honestly feel for the OP having to still support that crap. – Rory McCrossan Sep 20 '18 at 10:16
  • Gosh! I'm just wondering, if there's actually any device left and in active use from those years ... – Teemu Sep 20 '18 at 10:22
  • @RoryMcCrossan I don't think this is a duplicate. The link offered doesn't resolve my issue. – bilpor Sep 20 '18 at 10:29
  • `...compatibility view isn't set this is testing against a 'true' I.E.9. browser` then what browser is it? Your question states multiple times that it's IE9. Given your requirement to use `IE=edge` then you appear to be stuck. I doubt it's possible to solve both issues. Do you *really* need to support IE9? – Rory McCrossan Sep 20 '18 at 10:30
  • @RoryMcCrossan it is an i.e.9 browser, but one of the answers on the link suggests turning compatible view on. (which you can do with i.e.9, but I don't need too). – bilpor Sep 20 '18 at 10:32
  • "Compatible view" means IE7, that won't solve the problem. Setting `IE=edge` is equivalent to `IE=9` in real IE9 (desktop) browsers. – Teemu Sep 20 '18 at 10:38
  • @Teemu I already have this `` set in my header, but it'snot helped on resizing i.e.9. It's strange, as I have to support i.e.8 as well, and that works surprisingly. I thought it was going to be i.e.8 that was going to give me the most issues. – bilpor Sep 20 '18 at 10:41
  • Hmm... Are you testing with real versions of the said browsers, not just downgrading IE11? IE9 had some issues with HTML4 code (mainly with frameset etc.), when HTML5 DTD was used, maybe this is a part of those issues ... Have you tried the old HTML4 DTD? – Teemu Sep 20 '18 at 10:46
  • @Teemu No, I'm testing with an I.E.9 browser on Windows 7 – bilpor Sep 20 '18 at 10:49

0 Answers0