在带有 Chrome Frame 的 IE 中,单击文件附件的链接后,Javascript 被阻止
这是一个奇怪的。扔出去看看有没有人有想法。
仅当安装了 Chrome Frame 时,IE 才会出现此问题。似乎影响所有版本的 IE。
当用户下载文件时,应用程序停止响应(文件已成功下载)。链接仍然有效,但所有 JS 似乎都被阻止了。如果用户重新加载浏览器,应用程序可以正常工作,并且重新下载(即使是相同的文件)也不会再导致应用程序挂起。
这是一个示例链接(完全是普通的):
<a id="m2658941440_a0_1316118824779" href="getAttachment.do?messageId=2658941440&attachmentId=0&preventCache=1316118825309" class="attachment" _dijitmenudijit_menu_7="1">attachment_prob.txt (277 bytes)</a>
这是 Fiddler 报告的请求和响应。
请求:
GET https://www.foo.net/getAttachment.do?messageId=2658941440&attachmentId=0&preventCache=1316122999730 HTTP/1.1
Accept: text/html, application/xhtml+xml, */*
Referer: https://www.foo.net/main.do
Accept-Language: en-US
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; chromeframe/13.0.782.220)
Accept-Encoding: gzip, deflate
Host: www.foo.net
Connection: Keep-Alive
Cookie: __utma=185983734.639214142.1315756824.1316118759.1316121566.5; __utmb=185983734.2.10.1316121566; __utmz=185983734.1315756824.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmc=185983734; fooDomain=foo.net; isYtBlocked=true; TIME$STATE=10ba57c6bdb0075922b4c9ad4ef9940baf6bde26c79f3c6bcfe700413fe1710e; xgh=gnweb10; JSESSIONID=8487D0FE3D31EE81D2DE4E0BD19B7104; BIGipCookie=000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000; cdnPath="https://cdn.foo.net"; SESSION$STATE=10ba57c6bdb0075922b4c9ad4ef9940baf6bde26c79f3c6bcfe700413fe1710e; JID=mtyson; XMPPTOKEN=4662e808-1492-45ff-9aa7-ca39969574ea; contest-data=null; Foo.web3.foo.net.-csdvew.86158rid=5648145; PHPSESSID=cfepc8dnvmj94tbrqb8nbb03r0; Foo.web3.foo.net.-csdvew.86158sid=7ff697be-0d55-40c7-bb4a-f896443b22c3
响应:
HTTP/1.1 200 OK
Date: Thu, 15 Sep 2011 21:43:32 GMT
Server: Apache/2.2.10 (Fedora)
Content-Disposition: attachment; filename="attachment_prob.txt"
Cache-Control: max-age=2
Expires: Thu, 15 Sep 2011 21:43:34 GMT
Set-Cookie: xgh=gnweb10; path=/;
Set-Cookie: BIGipCookie=000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Vary: User-Agent,Accept-Encoding
P3P: policyref=http://www.foo.net/w3c/p3p.xml, CP=ALL
Connection: close
Content-Type: text/plain; name=attachment_prob.txt;charset=us-ascii
Content-Length: 277
https://www.foo.net/messages.do?op=messageDetail&userId=12735728&messageId=2620253518&owner=true
select groupid, shardid from users where userid=12735728;
+---------+---------+
| groupid | shardid |
+---------+---------+
| 57826 | 2 |
+---------+---------+
更新 1 事实证明,任何返回下载的内容都会导致问题。甚至:
<a id="m2658941440_a0_1316118824779" href="http://download.mozilla.org/?product=firefox-6.0.2&os=win&lang=en-US" class="attachment" _dijitmenudijit_menu_7="1">attachment_prob.txt (277 bytes)</a>
产生问题。
但
<a id="m2658941440_a0_1316118824779" href="http://www.google.com" class="attachment" _dijitmenudijit_menu_7="1">attachment_prob.txt (277 bytes)</a>
没有。
更新2 根据gilly3的评论,如果目标设置为_blank,文件将在新选项卡中正常下载,而不会破坏主页上的JS。
我尝试将目标指向主页中的 iframe,但在这种情况下确实存在问题。
Here's a strange one. Throwing it out there to see if anyone has any thoughts.
This problem only occurs with IE when Chrome Frame is installed. Appears to affect all version of IE.
When a user downloads a file, the app stops responding (the file is successfully downloaded). Links still work, but all JS appears to be blocked. If the user re-loads the browser, the app works fine, and re-downloading (even the same file) no longer causes the app to hang.
Here is an example link (just totally vanilla):
<a id="m2658941440_a0_1316118824779" href="getAttachment.do?messageId=2658941440&attachmentId=0&preventCache=1316118825309" class="attachment" _dijitmenudijit_menu_7="1">attachment_prob.txt (277 bytes)</a>
And here is the request and response as reported by Fiddler.
REQUEST:
GET https://www.foo.net/getAttachment.do?messageId=2658941440&attachmentId=0&preventCache=1316122999730 HTTP/1.1
Accept: text/html, application/xhtml+xml, */*
Referer: https://www.foo.net/main.do
Accept-Language: en-US
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; chromeframe/13.0.782.220)
Accept-Encoding: gzip, deflate
Host: www.foo.net
Connection: Keep-Alive
Cookie: __utma=185983734.639214142.1315756824.1316118759.1316121566.5; __utmb=185983734.2.10.1316121566; __utmz=185983734.1315756824.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utmc=185983734; fooDomain=foo.net; isYtBlocked=true; TIME$STATE=10ba57c6bdb0075922b4c9ad4ef9940baf6bde26c79f3c6bcfe700413fe1710e; xgh=gnweb10; JSESSIONID=8487D0FE3D31EE81D2DE4E0BD19B7104; BIGipCookie=000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000; cdnPath="https://cdn.foo.net"; SESSION$STATE=10ba57c6bdb0075922b4c9ad4ef9940baf6bde26c79f3c6bcfe700413fe1710e; JID=mtyson; XMPPTOKEN=4662e808-1492-45ff-9aa7-ca39969574ea; contest-data=null; Foo.web3.foo.net.-csdvew.86158rid=5648145; PHPSESSID=cfepc8dnvmj94tbrqb8nbb03r0; Foo.web3.foo.net.-csdvew.86158sid=7ff697be-0d55-40c7-bb4a-f896443b22c3
RESPONSE:
HTTP/1.1 200 OK
Date: Thu, 15 Sep 2011 21:43:32 GMT
Server: Apache/2.2.10 (Fedora)
Content-Disposition: attachment; filename="attachment_prob.txt"
Cache-Control: max-age=2
Expires: Thu, 15 Sep 2011 21:43:34 GMT
Set-Cookie: xgh=gnweb10; path=/;
Set-Cookie: BIGipCookie=000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Vary: User-Agent,Accept-Encoding
P3P: policyref=http://www.foo.net/w3c/p3p.xml, CP=ALL
Connection: close
Content-Type: text/plain; name=attachment_prob.txt;charset=us-ascii
Content-Length: 277
https://www.foo.net/messages.do?op=messageDetail&userId=12735728&messageId=2620253518&owner=true
select groupid, shardid from users where userid=12735728;
+---------+---------+
| groupid | shardid |
+---------+---------+
| 57826 | 2 |
+---------+---------+
UPDATE 1
Turns out ANYTHING that returns a download will cause the problem. So even:
<a id="m2658941440_a0_1316118824779" href="http://download.mozilla.org/?product=firefox-6.0.2&os=win&lang=en-US" class="attachment" _dijitmenudijit_menu_7="1">attachment_prob.txt (277 bytes)</a>
Produces the problem.
But
<a id="m2658941440_a0_1316118824779" href="http://www.google.com" class="attachment" _dijitmenudijit_menu_7="1">attachment_prob.txt (277 bytes)</a>
does NOT.
Update 2
Based on gilly3's comment, if the target is set to _blank, the file will download ok in a new tab, without breaking JS on main page.
I tried pointing the target to an iframe in the main page, but the problem does present in that case.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过以编程方式创建 Iframe 并将其 url 设置为文件下载来解决此问题,而不是使用当前窗口。这解决了这个问题。
我注意到它被破坏的方式是使用 IE 下载器(尽管它是 chromeframe)。当我使用 iframe 时,它使用 chrome 下载器。
I worked around this by programatically creating an Iframe, and settings its url to the file download, instead of using the current window. That fixed this.
I noticed with the way it was broken, it was using the IE downloader (despite it being chromeframe). When I use the iframe, it uses the chrome downloader.