It looks like jQuery's ready() function doesn't fire when the Back
button is used if only the page anchor location in the URL changes.

Example:
Say you go to here

     http://mywebsite.com/#test1

then here

     http://mywebsite.com/#test2

and then use the Back button to go back to here

    http://mywebsite.com/#test1

and you have this code in the page

<script language="javascript" type="text/javascript" src="/
jquery.js"></script>
<script language="javascript" type="text/javascript">
history.navigationMode = 'compatible';
$(document).ready( function() {
   if(document.location.hash){
      var hashQueryString = document.location.hash;
      hashQueryString = hashQueryString.replace("#","");
      alert(hashQueryString);
   }
});

You don't get the alert pop up when you use the Back button to go back
to the #test2 URL.  The ready() function fires when the Back button is
used if the query string (i.e, php?var1=value1) changes but not for
hash marks.

Is this on purpose or is this a bug?  And does anyone know a
workaround?  I'm trying to develop a way to get the Back button to go
back to previous states of a page that were created by JavaScript/AJAX
manipulations.

Thanks!

Reply via email to