[Webkit-unassigned] [Bug 26812] New: Hash (anchor) navigation history does not work after document.location.replace()

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jun 29 13:36:59 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=26812

           Summary: Hash (anchor) navigation history does not work after
                    document.location.replace()
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Windows XP
            Status: UNCONFIRMED
          Severity: Major
          Priority: P2
         Component: History
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: max.starets at oracle.com


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>


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list