简体   繁体   English

Internet Explorer仅部分加载JavaScript / CSS

[英]Internet Explorer only part loading JavaScript/CSS

I'm having trouble with my local development environment where IE (6 through to 8) is only part loading JavaScript/CSS files. 我在本地开发环境中遇到了麻烦,其中IE(6至8)只是部分加载JavaScript / CSS文件。 It throws random errors at random places in jquery.min.js every time I refresh, which suggested to me that it's trying to execute before it's finished loading or the connection was closed before it finished loading. 每次刷新时,它都会在jquery.min.js中的随机位置引发随机错误,这向我提示它正在尝试在完成加载之前执行,或者在完成加载之前关闭了连接。

I've looked at the responses using Charles and Apache is returning the correct content-length header for the files I'm having trouble with but the text response is always truncated. 我已经使用Charles查看了响应,Apache会为遇到问题的文件返回正确的content-length标头,但文本响应始终会被截断。

I also tried disabling g-zip compression, as I noticed that responses to IE don't have the Content-Encoding: g-zip header, but that breaks things in Firefox (in the same way) and doesn't fix the problem with IE. 我还尝试禁用g-zip压缩,因为我注意到对IE的响应没有Content-Encoding: g-zip标头,但这会破坏Firefox中的内容(以相同的方式),并且无法解决以下问题: IE浏览器

I've looked at my Apache config and it is no different to the staging server where I'm not experiencing these issues. 我已经看过我的Apache配置,它与没有遇到这些问题的登台服务器没有什么不同。

I've changed this line: 我更改了这一行:

BrowserMatch bMSIEs(7|8) !no-gzip !gzip-only-text/html

to this: 对此:

BrowserMatch \\bMSIE !no-gzip !gzip-only-text/html

In my config and that seems to fix it, still not sure why it's working differently locally. 在我的配置中,这似乎可以解决问题,仍然不确定为什么它在本地的工作方式有所不同。

The directives causing the browser to load stuff - scripts, images, etc. are executed asynchronously. 导致浏览器加载内容的指令-脚本,图像等是异步执行的。 If your javascript is not self contained I mean relies on anything from any other file, you should not try to execute it using inline statements - you have no way of knowing whether this other file completed loading. 如果您的JavaScript不是自包含的,我的意思是依赖于任何其他文件中的任何内容,则不应尝试使用内联语句执行它-您无法知道此其他文件是否已完成加载。

What you need to do is to trigger execution from the page loaded event 您需要做的是从页面加载事件触发执行

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

相关问题 javascript:Internet Explorer中未加载图片 - javascript : image is not loading in internet explorer JavaScript 或 CSS 无法在 Internet Explorer 上运行 - JavaScript or CSS not working on Internet Explorer Javascript / css 在 Inte.net Explorer 中不工作 - Javascript / css not working in Internet Explorer 在Internet Explorer 10中仅显示“正在加载” - Only showing “Loading” in Internet Explorer 10 等效于Internet Explorer,用于在javascript中加载文本文件 - Internet explorer equivalent for loading a text file in javascript Internet Explorer 8,9,10 javascript无法正确加载 - Internet Explorer 8, 9, 10 javascript not loading correctly 在某些情况下,例如特定于Internet Explorer的CSS或特定于Internet Explorer的JavaScript代码,如何仅将Internet Explorer 10定位? - How do I target only Internet Explorer 10 for certain situations like Internet Explorer-specific CSS or Internet Explorer-specific JavaScript code? 使用 JavaScript 在 Internet Explorer 中插入外部 CSS - Inserting external CSS in Internet Explorer using JavaScript CSS表达式与Internet Explorer的过滤器和Javascript - CSS expressions vs Filters and Javascript for internet explorer 插入CSS动画Internet Explorer Javascript - Insert css animation internet explorer javascript
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM