reading location.hash IE 6
IE 6 doesn't seem to be updating location.hash or location.href after using the back button.
This works in netscape and moz. but not IE.
On the page I'm trying 3 different methods to set the hash
setting: location.hash = 'hash'
setting: location.href = 'anchors.html#hash'
setting: hash through regular link
JS will read the hash once it's been set, but hitting back doesn't seem to be updating the location object.
Any thoughts on how to get it to read the hash after hitting back?
The "Back" button contains an array of the window.location.href not of the document
You need to give the full URL to window.location.href for the "back" button to work
Was this your intention?
I tried reading window.location.href and window.location.hash and that didn't work either.
For security reasons you can not read this array.
I'm not trying to read the history array, I'm trying to read the current document.location. When you hit the back button the url location doesn't update.
Can you post a link to an example of what you are talking about? Also, this might help.
Are you not trying to go to a bookmark that does not exist?
Your code does cause an error in Mozilla.
pyro, there is a link in my first post refering to the problem. I have an interval running which displays the location.href and location.hash of the current page, when you click one of the buttons or links, the text fields update with the new href and hash information, but when hitting the back button, the hash and href don't update, interestingly enough, the link you gave me does update when hitting the back button.
looking at the link you posted further, it appears they are actually sending the browser to a new page, rather than sending the browser to an anchor within that page.
I need a method for finding out which anchor they are at after hitting the back button, without sending the current document to a new page everytime.
Fang, I'm not sure what you mean. I'm not trying to go to a bookmark, I just need to know what anchor the user is currently located at.
the code for teh page is just a timeout interval output location.href and location.hash
document.getElementById("intervalcheck").value = i++;
document.getElementById("hashoutput").value = document.location.hash;
document.getElementById("hrefoutput").value = document.location.href;
document.location.hash will give you the anchor.
The problem with IE appears to be the reference to "top".
Change "top" to "tops" and the problem disappears.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)