SCRIPT5009:“$”在 IE9 中未定义
我有一个书签,它将 div 加载到当前页面并在其中放置一个 iframe。除了 IE9 之外,小书签在所有浏览器中都可以正常工作。甚至可以在早期版本的 IE 中运行。
我正在使用以下小书签框架:
http://idc.anavallasuiza.com/project/bookmarklets
其他人也遇到了类似的问题(与小书签无关):
https://forum.jquery.com/topic/retrieved-html-data-type-with-jquery-ajax-in-ie9-scripts-tags-sources-could-not-be-loaded
到目前为止,我了解到我的小书签的 jQuery 未在 IE9 中正确加载。
小书签尝试加载自己的 jQuery,以便在小书签初始化时可以运行某些效果,并简化编程。
iFrame 页面还加载 jQuery(没有它,iframe 中的内容将无法正常工作)。
我正在使用最新的 jQuery:
http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
我想知道为什么 IE9 会导致这些 SCRIPT 错误,而其他浏览器却不会?为什么 jQuery 在 IE9 中无法正确加载?
任何见解将不胜感激。
I have a bookmarklet that loads a div into a current page and places an iframe inside it. The bookmarklet works like a dream in all browsers except IE9. Even works in earlier versions of IE.
I'm using the following bookmarklet framework:
http://idc.anavallasuiza.com/project/bookmarklets
Some one else has had a similar issue here (not related to bookmarklets):
https://forum.jquery.com/topic/retrieved-html-data-type-with-jquery-ajax-in-ie9-scripts-tags-sources-could-not-be-loaded
So far I'm understanding that my bookmarklet's jQuery is not loading properly in IE9.
The bookmarklet attempts to load its own jQuery so certain effects can run when the bookmarklet is initialising, and for programming ease.
The iFrame page also loads jQuery (without it the content in the iframe does not work properly).
I am using the latest jQuery:
http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
I would like to know why IE9 causes these SCRIPT errors when no other browser does? Why is jQuery not loading properly in IE9?
Any insight would be much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我刚刚花了几个小时来解决这个问题,终于找到了一个我认为会对您有所帮助的解决方案。
这是给我带来问题的代码的简化版本:
** 将一个或多个帧加载到不在 DOM 中的 div 中,然后将该 div 加载到 DOM 中会导致我的情况下出现所有问题。框架没有按应有的方式加载 JS 脚本,然后所有内容(jQuery、JSON 等)都是未定义的。
另一方面,这是可行的:
这里唯一的区别是我首先将 div 放入 dom 中,然后将框架加载到其中。不知怎的,这让一切变得不同。
I have just spent some hours wrestling with this problem and finally found a solution that I think will help you.
Here's a simplified version of the code that caused problems for me:
** Loading one or more frames into a div that's NOT in the DOM and THEN loading that div into the DOM causes all the problems in my cases. The frames don't load JS scripts as they should, and then everything (jQuery, JSON, etc) are undefined.
This, on the other hand, works:
The only difference here is that I am placing the div in the dom first and THEN loading the frames into it. Somehow that makes all the difference.
谢谢你的问题,我也遇到了同样的问题。我第一次通过从 jquery.com 加载 jquery 来修复它( http://code. jquery.com/jquery-1.7.1.js )。然后IE9加载它。也许微软正在阻止一些谷歌API?非常有趣...
thanks for your question, I had the same problem. for the first time I fixed it with loading jquery from jquery.com ( http://code.jquery.com/jquery-1.7.1.js ). then IE9 loads it. maybe microsoft is blocking some google-apis? very interesting...