Bug Tracker

Opened 15 years ago

Closed 14 years ago

Last modified 11 years ago

#3019 closed bug (duplicate)

Using AJAX type=script or type=jsonp on IE6 sometimes breaks

Reported by: bgoldman Owned by:
Priority: major Milestone: 1.3
Component: ajax Version: 1.2.6
Keywords: Cc:
Blocked by: Blocking:


On IE6, I noticed that one of my AJAX requests was failing. The AJAX request was using type=jsonp. After doing a very thorough round of testing and trying to narrow down the bug, I came to the conclusion that when using type=script or type=jsonp, IE6 fails if also the page making the AJAX request is inside an iframe, and also if Cache-control is set to no-store, and also only if the url being called is on a different domain. It's a very obscure IE6 bug. I found that a solution to this bug was modifying jQuery to use document.body.appendChild(script) instead of head.appendChild(script). I think a good fix in jQuery would be to just append to document.body instead of head. So instead of creating a head variable which is used to append for cross-domain script/jsonp, just make a generic script_parent or something. I am attaching a zip of some files to reproduce the bug. Try accessing index.php in Firefox and IE6 and notice an alert both times. However, try accessing bug.html in Firefox and IE6 and notice the bug. The bug also only appears about 50% of the time, not even always, in IE6. Like I said, it's obscure :)

Attachments (1)

jquery-bug-ie6.zip (31.6 KB) - added by bgoldman 15 years ago.

Download all attachments as: .zip

Change History (5)

Changed 15 years ago by bgoldman

Attachment: jquery-bug-ie6.zip added

comment:1 Changed 14 years ago by iraebrasil

I'm having the same problem here.

I've tested bgoldman sugestion to evaluate the script in the body but this have not solved the issue to me.

In my case the problem is only trigered when you enter the page from a link. When you type it directly on the addressbar or you force a reload the page and all jsonp requests execute properly.

I'm investigating if this has something to do with the referrer.

comment:2 Changed 14 years ago by iraebrasil

I've found an odd workaround. This most probably could not be used in jQuery, but may be useful as a testing ground:

I'm really ashamed of that script, but I've not found any other solution. I have no access to the code outputed by the jsonp so I can't debug (or in my case would be useless to debug in my own server) any further.

// Watch out for an weird IE6 bug with firing
// cross-domain jsonp at DOM ready
if($.browser.msie && $.browser.version == '6.0'
		&& document.cookie.indexOf('reloading=1') === -1) {
	document.cookie = 'reloading=1;max-age=5';
} else {
	document.cookie = 'reloading=0;max-age=5';

This is in production and fully working at: http://tvuol.uol.com.br/ With unpacked source at: http://tvuol.uol.com.br/tvuol.full.js

comment:3 Changed 14 years ago by dmethvin

Seems to be related to #3705 and #3283.

comment:5 Changed 14 years ago by brandon

Resolution: duplicate
Status: newclosed

Consolidating this into #4378

Note: See TracTickets for help on using tickets.