简体   繁体   English

IE9阻止jQuery CDN

[英]IE9 blocking jQuery CDN

I'm having issues with IE9 in our new website. 我在新网站上遇到IE9问题。 The jQuery files aren't loading. jQuery文件未加载。 I've tried the CDN on Google initially but have also tried the Microsoft CDN, both failing. 我最初在谷歌尝试过CDN,但也试过微软CDN,都失败了。 I've seen posts about using the latest version of jQuery. 我见过有关使用最新版jQuery的帖子。 I've grabbed the latest (1.6.4) and that's not helped. 我抓住了最新的(1.6.4)并没有帮助。 I understand it's the tracking protection but since this is our 'front end' site it's not like we can get browsers to add our site to their 'white list' or disable tracking protection. 我理解这是跟踪保护,但由于这是我们的“前端”网站,我们不能让浏览器将我们的网站添加到他们的“白名单”或禁用跟踪保护。

Whilst hosting the files locally is the obvious next step my other concern is that google analytics code is also failing. 虽然在本地托管文件是显而易见的下一步,但我的另一个问题是谷歌分析代码也失败了。

Is there a solution to this? 有针对这个的解决方法吗?

Use the implementation of jquery as outlined in http://html5boilerplate.com/ . 使用http://html5boilerplate.com/中概述的jquery实现。

<!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.6.4.min.js"><\/script>')</script>

Some variations of jhanifen's solution . jhanifen解决方案的一些变化。 By using head.js lib we can load jQuery and other libs a bit faster: 通过使用head.js lib,我们可以更快地加载jQuery和其他库:

<script src="js/libs/head.load.min.js"></script>
<script>
    head.js("https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js",function() {
      window.jQuery || head.js("js/libs/jquery-1.7.1.min.js");
    });
</script>

I thought it best to add my results in an answer incase someone hits this and doesn't browse the comments but best to follow the comments from the answer by @jhanifen. 我认为最好在答案中添加我的结果,如果有人点击这个并且不浏览评论,但最好遵循@jhanifen的答案中的评论。 I had to use a local copy of jQuery, using the CDN (even on Microsoft's CDN) didn't work. 我不得不使用jQuery的本地副本,使用CDN(即使在微软的CDN上)也无法正常工作。

My google code wasn't sat below the end body tag, it was just above it, rectifying that resolved the issue. 我的谷歌代码没有位于最终机身标签下方,它就在它上方,纠正解决了这个问题。

Typekit, I had to use conditionals, but then that defeats the object of using Typekit, especially considering you'd think IE9 was 'a modern browser'. Typekit,我不得不使用条件,但是那会破坏使用Typekit的对象,特别是考虑到你认为IE9是'现代浏览器'。 Crazy! 疯!

I've queried Typekit to see if they have a work around and will edit this if they come back with anything helpful. 我查询了Typekit,看看他们是否有解决方法,如果他们回来时有任何帮助,我们会编辑它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM