【问题标题】:jQuery & CSS only load after many refreshesjQuery & CSS 仅在多次刷新后加载
【发布时间】:2015-09-09 11:32:59
【问题描述】:

如果您在 IE11 中打开此页面,CSS 和 jQuery 不会加载:http://javasmart.gooberdev.com/

如果您刷新页面一次,甚至两次,它仍然无法加载。但是如果你连续按 F5 很多次,CSS 和 jQuery 最终会加载并且页面正确显示。

这是我见过的最奇怪的错误之一,坦率地说,我不知道是什么原因造成的。 **仅在 IE 中出现。 Chrome 和 Firefox 运行良好。

Magento head.phtml 文档:

<meta http-equiv="Content-Type" content="<?php echo $this->getContentType() ?>" />
<title><?php echo $this->getTitle() ?></title>
<meta name="description" content="<?php echo htmlspecialchars($this->getDescription()) ?>" />
<meta name="keywords" content="<?php echo htmlspecialchars($this->getKeywords()) ?>" />
<meta name="robots" content="<?php echo htmlspecialchars($this->getRobots()) ?>" />
<link rel="icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />
<link rel="shortcut icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />

<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<!--[if lt IE 7]>
<script type="text/javascript">
//<![CDATA[
    var BLANK_URL = '<?php echo $this->helper('core/js')->getJsUrl('blank.html') ?>';
    var BLANK_IMG = '<?php echo $this->helper('core/js')->getJsUrl('spacer.gif') ?>';
//]]>
</script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="/skin/frontend/magpassion/relank/css/custom.css" media="all" />
<script type="text/javascript" src="http://fast.fonts.net/jsapi/ea7ed50d-f26c-4089-bf7d-063665c359e7.js"></script>
<link href='http://fonts.googleapis.com/css?family=Roboto:400,500,400italic,500italic' rel='stylesheet' type='text/css' />
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" />
<?php echo $this->getCssJsHtml() ?>

<?php echo $this->getChildHtml() ?>
<?php echo $this->helper('core/js')->getTranslatorScript() ?>
<?php echo $this->getIncludes() ?>

【问题讨论】:

  • 您的&lt;head&gt; 表明您正在加载三个不同版本的jQuery。只会使用最后一个加载的,仅供参考。
  • 你的页面需要很长时间才能加载,也许你应该下载从网络加载的脚本/css并将它们包含在你的项目中。
  • 我看到了 jQuery 版本 1.4.2、1.6.4、1.7.2 和 1.10.2。我认为这是一个新的个人记录。

标签: jquery css html internet-explorer internet-explorer-11


【解决方案1】:

我只有在 IE 注意到标题中的 X-UA 标记以强制 IE8 标准时才会遇到问题。一堆 JavaScript 加载失败,页面的其余部分崩溃了。
如果我忽略此标签并使用 F12 使用 Edge 进行渲染,页面对我来说总是完美无缺。

<meta http-equiv="X-UA-Compatible" content="IE=8" />

这里有一篇很好的帖子:

"X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE"

【讨论】:

  • 知道了!将其更改为 IE=edge 解决了问题。
猜你喜欢
  • 2016-10-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-04-10
  • 1970-01-01
  • 1970-01-01
  • 2015-07-09
相关资源
最近更新 更多