WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
UNCONFIRMED
26812
Hash (anchor) navigation history does not work after document.location.replace()
https://bugs.webkit.org/show_bug.cgi?id=26812
Summary
Hash (anchor) navigation history does not work after document.location.replace()
Max Starets
Reported
2009-06-29 13:36:59 PDT
The standalone test case below reproduces the problem. 1. After you run the page, try navigating to an anchor by wither using a link ("Test anchor link") or Javascript ("navigate" button). Note that the URL gets updated with the new hash value. 2. Hit the 'Back' button. Instead of navigating within the same page to a URL without the hash, the browser navigates to a previous page. 3. Try removing onload on the body - the test no longer performs a redirect, and the anchor navigation works as expected. This feature is very important for maintaining navigation state for AJAX requests. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd
"> <html> <body onload="initialRedirect();"> <a id="test"></a> <a href="#test">Test anchor link</a> <br> <button onclick="navigate();">Navigate</button> <script> function initialRedirect() { var search = document.location.search; if (!search || search.indexOf('blah') < 0) { document.location.replace("test1.html?test=blah"); } } function navigate() { window.location.hash = "#test"; } </script> </body> </html>
Attachments
Test case
(565 bytes, text/html)
2009-06-29 13:38 PDT
,
Max Starets
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Max Starets
Comment 1
2009-06-29 13:38:44 PDT
Created
attachment 32019
[details]
Test case Same test case was inlined in the bug body
Mark Rowe (bdash)
Comment 2
2009-06-29 14:01:39 PDT
<
rdar://problem/7017117
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug