ZOMDir > Blog

Monday, 9 September 2013

Javascript and a broken back button

For the ZOMDir project I use as little javascript as possible. The site should always work and not depend on a feature like javascript. Nevertheless I use javascript to smooth the browsing experience. 

In the javescript I use code like:


window.location.href = "http://example.zomdir.com";


However this code gives a broken backbutton in Internet Explorer 8. After such a redirect and pressing the backbutton the user gets the message "The webpage is expired". To solve this I have coded the redirect like this:


window.location.replace("http://example.zomdir.com");


It is a small change, but it fixed the problem.



No comments:

Post a Comment