Closed Bug 513268 Opened 15 years ago Closed 12 years ago

url not saved in session history when doing a javascript redirect using jquery's weird JSON getter

Categories

(Core :: DOM: Navigation, defect)

x86
Windows Vista
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 754029

People

(Reporter: mihaigrigori, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 (.NET CLR 3.5.30729)

I'm doing a javsacript redirect as a result of a JSON call.
On the url above, if you click the button on that page an json call is fired and the location is changed with location.href. 
Unlike in any other browser, the 'back' button remains inactive if the url was loaded in a new tab or clicking back skips the initial url.



Reproducible: Always

Steps to Reproduce:
1. load http://culinar.monline.ro/redirect-bug/page-1.php in a new tab
2. click the 'CLICK ME!' button
3. on the new page (http://culinar.monline.ro/redirect-bug/page-2.php) look at the browser's back button - it's not active so you can return the first page


Expected Results:  
The browser 'back' button should be active so one can return from http://culinar.monline.ro/redirect-bug/page-2.php to http://culinar.monline.ro/redirect-bug/page-1.php
Reporter, are you still seeing this issue with Firefox 3.6.10 or later in safe mode or a fresh profile? If not, please close. These links can help you in your testing.
http://support.mozilla.com/kb/Safe+Mode
http://support.mozilla.com/kb/Managing+profiles
Whiteboard: [CLOSEME 2010-11-01]
Still happening if you follow the steps to reproduce that I described above.

Thanks
Whiteboard: [CLOSEME 2010-11-01]
Version: unspecified → 3.6 Branch
Component: Bookmarks & History → Document Navigation
Product: Firefox → Core
QA Contact: bookmarks → docshell
Summary: url not saved in browser history when doing a javascript redirect → url not saved in session history when doing a javascript redirect
Version: 3.6 Branch → unspecified
What's happening here is that we end up doing a replace load.

And the reason for that is the fix for bug 72197: the way jquery runs this code is by inserting a <script> that ends up calling the given code.  So we trigger the inScriptTag case that bug fix added.

ccing some folks who might know what html5 says about this.  The replace behavior is clearly needed in some cases, but presumably only before the page finishes loading, right?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Note: the relevant code looks like this:

        $.getJSON('json-handler.php?jsoncallback=?', {}, function(msg){
            location.href='http://culinar.monline.ro/redirect-bug/page-2.php';    
            return true;
        });
Summary: url not saved in session history when doing a javascript redirect → url not saved in session history when doing a javascript redirect using jquery's weird JSON getter
> The replace behavior is clearly needed in some cases, but presumably only 
> before the page finishes loading, right?

Per Hixie's list (reproduced in bug 615611), assigning to location.href should load with replacement only if the load, pageshow, and popstate events all haven't finished firing.

So yes, I think so.
The URL is not valid any longer. However, according to these comments, it seems same as bug 754029.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.