Skip to main content

Bug Tracker

Side navigation

#3019 closed bug (duplicate)

Opened June 10, 2008 09:10PM UTC

Closed March 18, 2009 10:22PM UTC

Last modified March 14, 2012 04:53PM UTC

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:
Description

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)
Change History (4)

Changed September 23, 2008 03:20AM UTC by iraebrasil comment:1

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.

Changed September 24, 2008 04:12AM UTC by iraebrasil comment:2

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';
	window.location.reload();
} else {
	document.cookie = 'reloading=0;max-age=5';
	$(initInterface);
}

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

Changed February 15, 2009 07:09PM UTC by dmethvin comment:3

Seems to be related to #3705 and #3283.

Changed March 18, 2009 10:22PM UTC by brandon comment:4

resolution: → duplicate
status: newclosed

Consolidating this into #4378