javascript - Why I can't detect Media Queries in IE9 using modernizr -


i searched support of css3 media queries in browsers, , ie9+ support it, http://caniuse.com/css-mediaqueries, when use modernizr detect it, turns out, ie7-ie9 not support it, ie10 support it. :

  1. generate custom modernizr js: http://modernizr.com/download/#-mq-teststyles-load

  2. html code: below code in html head, want detect if browser support min-width media query use, if support, add support.js, if not, include nosupport.js

    <script src="modernizr.custom.03829.js" type="text/javascript"></script> <script>     modernizr.load({         test: modernizr.mq('(min-width: 0px)'),         yep: 'support.js',         nope: 'nosupport.js'     }); </script> 
  3. in support.js: alert("support");

  4. in nonosupport.js: alert("not support");

result: ie7-ie9 alert "not support", in ie10, alert "support". think ie9 should alert "support", right? there wrong code?

another weird thing if use sample usage http://modernizr.com/docs/#mq :

modernizr.mq('only screen , (max-width: 768px)')  // true 

chrom, firefox , ie7-10 alert "not support", think modern browsers should alert "support". why?

on first question - not able replicate. modernizr.mq('(min-width: 0px)') returns true in ie 9 me. check document mode in f12 tools see if falling non standards mode.

on second, browser modernness has nothing wether or not return true. modernizr.mq tests if browser matches media query. if false, means browser window larger 768 pixels.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -