0

I am using this code to test for media query support as I want to load a polyfill for e.g. IE8.

yepnope({
    test : Modernizr.mq('(only all)'),
    nope : ['scripts/respond.js']
});

It works (= respond.js gets loaded in oder IE), but now I've just discovered that respond.js also gets loaded in Safari.

After having read the docs I believe that respond.js is loaded because there are some kind of media queries Safari doesn't support. Is this true? How can I solve this issue?

Sam Hanley
  • 4,707
  • 7
  • 35
  • 63
Sven
  • 12,997
  • 27
  • 90
  • 148

2 Answers2

2

The problem isn't that Safari doesn't support certain media queries, but that (only all) is not a valid media query. There should be no parentheses around the only keyword or the media type all:

yepnope({
    test : Modernizr.mq('only all'),
    nope : ['scripts/respond.js']
});
BoltClock
  • 700,868
  • 160
  • 1,392
  • 1,356
0

I'm using modernizr as well but found the easiest way add media query support for IE7 and IE8 was simply to use something like this in the page head

<!--[if lt IE 9]>
  <script src="js/respond.js"></script>
<![endif]-->

Make sure you are calling respond.js after the CSS files have loaded.

This is working well for me.

Good luck!

David Taiaroa
  • 25,157
  • 7
  • 62
  • 50