10th Nov, 2007

JavaScript + Frames + IE 6 + gzip + “no-cache” Header = Trouble

So I was notified this past Friday that the JavaScript on our IDX solution was broken in IE 6, but only when it was being framed by one of our customers on their website. Weird, but I figured I must have busted something from my deploy earlier that day. After jumping into the problem, I realized that the issue wasn’t actually with my code but rather, believe it or not, with Google’s AJAX search API. Specifically, the issue that I found was that IE 6 absolutely will not execute JavaScript under the following conditions:

1) The visitor is using IE 6 to visit a page.
2) That page frames another page that requests JavaScript.
3) The JavaScript is served with HTTP headers that specifically include the “no-cache” command in the “Cache-control” headers; other, similar headers (such as “private”, “no-store”, etc) do not have the same effect.
4) The JavaScript is GZIP’d.

I figured that Google must have either recently added the no-cache header or recently started gzip-ing, so I posted the problem in Google Groups. Today, they made a post notifying me (and everyone else) that they fixed the problem. Sure enough, I fired up Fiddler just now, and it seems that they no longer gzip the response when serving up their www.google.com/jsapi application.

Anyway, I had encountered this problem before, but I just chalked it up to something that everyone else probably already knew. As it turns out, a Google search turns up absolutely nothing on this issue. Since I couldn’t find anything, I figured that the world would benefit from this knowledge.

Responses

Thanks Andrew!

I spent a whole day trying to debug a proxy script, which was working fine everywhere except IE. I couldnt beleive my eyes, when i finally realized that IE doesnt even load the linked jses, only when loaded outside of my iframes. Then i started to play with headers, still no luck, and then thanks to a google search i landed on your page.
I went on to unset my no-cache headers explicitly from php, and bang, it worked!

Thanks a lot, indeed it was very helpful!

Adam

http://support.microsoft.com/kb/321722

@Nick:

I saw that KB, but it’s not the same issue I experienced. In the KB, the result of the bug is that the JS content is always cached. In the issue I experienced, the JS wouldn’t even execute at all. The browser requested the file but seemed to put the contents of it into some kind of weird black hole w/o any sort of notification that it had done so.

Having the same issue with the translation API. According to Fiddler, it is still Gzipped…hopefully Google will correct this.

Leave a response

Your response:

Categories