08 February 2010

javascript back

Another little note to myself in the future: despite what w3schools says, history.back() is not the same as history.go(-1). Now, I don't know what the standards say, but the behavior of these two is different in the following way (at least in IE at the moment).

history.back() seems to return the previous page, but adds it as a 'new' page to the history. This means, that if every page on a site has a link for history.back(), the user will simply bounce between two pages, never actually going back through the history.

history.go(-1) seems to behave just like the back button of the browser: it moves the pointer of the current page back one in the history.