本文介绍了Respond.js无法在本地工作 - 支持IE8中的媒体查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用bootstrap3模板编写一个html页面,并在其中包含了respond.js,但是当我在IE8上运行它时,它在控制台中给出了错误访问被拒绝。
我用它来使IE8支持媒体查询。我在论坛上尝试了很多东西,但没有运气。 respond.js是在本地工作还是我们需要在localhost / web服务器上运行?

I am writing a html page using bootstrap3 template and including the respond.js in that, but when I run it on IE8, it gives me error "Access is denied" in console.I am using this to make IE8 support media queries. I have tried a lot of things as given on forums, but no luck. Does respond.js works locally or we need to run on a localhost/web server?

Respond.js link -

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

CSS - main.css

.main-cont {background:#2d3a42; height:100px;}


推荐答案

我设法做出回应.js通过在localhost上运行,在IE8上运行以获得媒体查询支持。如果仅打开html文件,则无效。

I just managed to make respond.js run on IE8 for media queries support , by running on localhost. If simply the html file opened, it does not help.

这篇关于Respond.js无法在本地工作 - 支持IE8中的媒体查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 08:15