Respond.js not working locally - Support for media queries in IE8

I am writing an html page using the bootstrap3 template and including response.js in this, but when I run it in IE8 it gives me a "Access denied" error in the console. I use this to make IE8 support media queries. I tried a lot of things as indicated on the forums, but no luck. Does response.js work locally or do we need to run on a local / web server?

Respond.js Link - https://github.com/scottjehl/Respond

HTML

<!DOCTYPE html> <html> <head> <title></title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="css/bootstrap.min.css" rel="stylesheet" media="screen"> <link href="css/main.css" rel="stylesheet" media="screen"> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]> <script src="js/html5shiv.js"></script> <script src="js/respond.js"></script> <![endif]--> </head> <body> <div class="container"> <h1>Hello, world!</h1> <div class="main-cont"> </div> </div> <script src="js/jquery-1.10.2.min.js"></script> <script src="js/bootstrap.min.js"></script> </body> </html> 

CSS - main.css

 .main-cont {background:#2d3a42; height:100px;} 
+6
source share
2 answers

I just managed to execute response.js on IE8 to support media queries by running on localhost. Just opening the html file will not help.

+7
source

In Docs Resppond.js ...

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

In particular, “Respond.js re-requests CSS files using Ajax and parses the text response”, in which the local IE security policy blocks you. Another user in another place suggested changing security settings in IE , but I can’t confirm this decision, since my copy of IE8 does not allow me to change these settings.

Oh, and to rid you of this problem, I already tested and confirmed that using the ajaxSetup () method in jQuery to set the isLocal property to true will not overcome the local limit in IE.

+9
source

Source: https://habr.com/ru/post/952862/


All Articles