Side navigation
#5097 closed bug (worksforme)
Opened August 24, 2009 02:22PM UTC
Closed December 24, 2010 02:53AM UTC
getJSON break FF history
Reported by: | monstroplante | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | |
Component: | ajax | Version: | 1.4.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
If i redirect on the callback of getJSON and then use the back button on the browser, the displayed page is not the exepted one. (tested on FF3.5).
Here is a test code :
<a class="btTest">Test</a>
<script type="text/javascript">
$('.btTest').click(function() {
$.getJSON('http://maps.google.com/maps/geo?callback=?', function() {
window.location = 'http://google.fr';
});
});
</script>
I found a hack :
Handle JSONP-style loading
window[ jsonp ] = function(tmp){setTimeout(function() {
data = tmp;
success();
complete();
Garbage collect
window[ jsonp ] = undefined;
try{ delete window[ jsonp ]; } catch(e){}
if ( head )
head.removeChild( script );
}, 1);};
Attachments (0)
Change History (6)
Changed June 13, 2010 05:01PM UTC by comment:1
component: | unfiled → ajax |
---|
Changed October 26, 2010 10:49PM UTC by comment:3
milestone: | 1.4 |
---|---|
priority: | major → low |
status: | new → open |
version: | 1.3.2 → 1.4.3 |
Changed October 26, 2010 10:52PM UTC by comment:4
milestone: | → 1.5 |
---|
Changed October 26, 2010 11:47PM UTC by comment:5
milestone: | 1.5 |
---|
When a script loads and immediately redirects the page, Firefox pretends that it like the server performed a 3xx direct and removes the previous page from the browser history. This has nothing to do with jQuery.
This does not happen if the assignment to window.location happens from the script’s onload
method, or if it is deferred using setTimeout
.
Workaround: Do not modify the location of the window using window.location in response to a JSONP call without wrapping it in setTimeout
.
Changed December 24, 2010 02:53AM UTC by comment:6
resolution: | → worksforme |
---|---|
status: | open → closed |