Grow your CSS skills. Land your dream job.

respond.js for CSS media queries

  • # May 18, 2012 at 10:37 am

    went to github, and checked out respond.js, demo worked fine on IE8, no problem with Chrome or FF.

    downloaded the code, ran test html on IE8, no go, media queries do not work with IE8, the html test code just does not work the same as the demo code on the same pc.

    anyone get respond.js test html included in the download working in IE8?? what is different between the online demo code and the download html test code?

    would like to revamp the web site I look after for the newer smaller screen sizes but running into this problem with IE8. IE8 is the most popular browser version used on this website, so anything like this needs to work with IE8.

    Al

    # May 19, 2012 at 10:09 am

    apparently respond.js must be run on a web server, it will not run locally, this was noted in the github documentation

    Al

    # June 21, 2013 at 7:20 am

    I have tried this and earlier it was working but after some days when I checked again, it’s stopped working and giving error.

    # June 21, 2013 at 10:23 am

    @almcrorie, you’re absolutely correct. The statement from the documentation delcaring this follows:

    > Due to security restrictions, some browsers may not allow this script to work on file:// urls (because it uses xmlHttpRequest). Run it on a web server.

    That being said, there are many options for developers locally. You could run MAMP, WAMP, enable IIS on your Windows machine, run the Python Simple Server, or even the built-in web server that ships with PHP.

    If non of those options sound appealing, you can simply permit your browser to allow scripts on the file protocol. In Chrome, you can run the browser with the –allow-file-access-from-files flag. Internet Explorer, traditionally, would allow file access from the file protocol when you used ActiveXObject to issue the request, but not for XMLHttpRequest. jQuery would use ActiveXObject when it was present, but this isn’t the case with IE10, I don’t believe.

    Another alternative is to use a different solution: Scott Jehl makes reference to one in the bottom of his README –[css3.mediaqueries.js](https://code.google.com/p/css3-mediaqueries-js/).

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".