views:

32

answers:

1

This is a problem that SWFAddress have fixed. But essentially, I'd like to write my own solution that strips out a lot of unused functions. Explanation below:

You can use the following code to get the hash value of the an URL link like this xxx.xxx.com/?#/DeepLinking/

window.location.hash

Using anchor tags with href='#tab1...etc. and Javascript, you can make deep linking work. Whenever the hash changes, I can serve the user different content.

The problem comes up when you use the back button and the window.location.hash. In other browsers other than IE, if you use the back button to go back to a previous hash symbol state, the window.location.hash returns the correct value. In IE, it does not return the current hash value but the one before any Back button was pressed.

I saw an Iframe fix but I'm not sure how exactly it works? Please provide a framework agnostic solution. Thanks!

A: 

I would have a look at the YUI 2: Browser History Manager. Browse through its sources to look how they did it.

EDIT: Or have a look at history.js from Google's Closure Library.

Marcel Korpel