views:

85

answers:

2

I've been looking for some javascript hooks for the back button in the browser. But they only seem to support back/forward between hashed url's. That is, you can only navigate from www.mysite.com#page1 and www.mysite.com#page2, if you click back, and the url becomes something without a hash, they all fail. Like this one: http://www.asual.com/jquery/address/samples/tabs/ Click one tab, then back, it won't work.

But on http://www.beautyoftheweb.com they've managed to get the backbutton to work between hashed and non-hashed url's. Any idea how they've done this?

+1  A: 
T.J. Crowder
Yes, but when you click back, and the hash goes away, it still works as you'd expect the back button to. And that's what I've been having some problems getting. The history plugins only seem to work between hashtagged urls, but they won't work when you click back from a hashtagged url to a non-hashtag url.
peirix
@peirix: That's not my experience with RSH. Haven't tried any of the others. You *do* (at least with RSH) have to handle the initial load correctly for the hash to work right out of the box, perhaps you're just seeing people using the libs somewhat naively?
T.J. Crowder
@peirix: In fact, I'm pretty sure that's what you're seeing; just updated my answer vis-a-vis a jQuery history plug.
T.J. Crowder
But if you load the url without the hash to begin with, click "load 2", and then click back, it won't do anything. It will keep "2" loaded. And that's where I'm having problems. Going back to a non-hashed url, and reloading the initial content.
peirix
A: 

From what I see, all the URLs are of the form http://www.beautyoftheweb.com/#/<something>, for example: http://www.beautyoftheweb.com/#/experience/cnn - hence, all are using hashes.

adamk
see my comment on T.J. Crowder's answer.
peirix