Reputation: 13295
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?
Upvotes: 0
Views: 674
Reputation: 25475
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!
Upvotes: 0
Reputation: 723729
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']
});
Upvotes: 2