如果您在 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() ?>
最佳答案
只有当 IE 注意到 header 中的 X-UA
标记以强制执行 IE8 标准时,我才会遇到问题。一堆 JavaScript 加载失败,页面的其余部分崩溃了。
如果我忽略此标记并使用 F12 使用 Edge 呈现,该页面对我来说总是完美无缺的。
<meta http-equiv="X-UA-Compatible" content="IE=8" />
这里有一篇很好的文章:
关于jQuery 和 CSS 仅在多次刷新后加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31006661/