Closed GoogleCodeExporter closed 8 years ago
"Does not being able to use <body onload> for the error callback cause issues?"
This. The only reason to use an iframe in the first place was to have a
cross-browser
way to detect errors using the iframe lifecycle itself. I'm currently working
on
other means to detect errors for other browsers, but that's still a work in
progress
(though I may have a solution for IE now).
I'm putting this on hold, for the sole reason it means a new way of detecting
jsonp
errors in FF.
Original comment by aubourg.julian
on 2 May 2010 at 1:06
I found you can use onerror in Firefox. The following is working for me:
// Write to the document
if ($.browser.mozilla)
document.write([
'<html><body onerror="',errorCallbackName,'()" onload="(function() {',
'var s = document.createElement(\'script\');',
's.type = \'text/javascript\';',
's.src=\'', finalUrl, '\';',
's.onload=', errorCallbackName, ';',
'document.body.appendChild(s);',
'})();"></body></html>'
].join(empty)
);
else
document.write([
'<html><head><script src="',
finalUrl,'" onload="',
errorCallbackName,'()" onreadystatechange="',
errorCallbackName,'(this.readyState)"></script></head><body onload="',
errorCallbackName,'()"></body></html>'
].join(empty)
);
Original comment by thomas...@gmail.com
on 2 May 2010 at 3:36
The only caveat that remains is that the page loading indicator is still
spinning for a very short time in Firefox
and in Chrome as well (when creating an iframe or calling document.open() on
it). Haven't found a way to prevent
this :-( I am thinking of creating multiple iframes at the beginning and then
reusing them in order to allow
multiple concurrent JSONP requests and preventing the page load indicator to
show up.
Original comment by thomas...@gmail.com
on 2 May 2010 at 3:40
2.0pre uses a similar trick as the one you suggested. This is as fixed as it
can get
for now I'm afraid.
Original comment by aubourg.julian
on 11 May 2010 at 5:13
2.0pre2 should completely remove the problem in FF. Webkit browsers (Chrome,
Safari)
are still using iframes though.
Original comment by aubourg.julian
on 12 May 2010 at 12:35
Also, this was a duplicate of #7
Original comment by aubourg.julian
on 27 May 2010 at 10:48
Original issue reported on code.google.com by
thomas...@gmail.com
on 30 Apr 2010 at 12:11