Maybe some of you use the following approach to create “back” links:
<a href="#" onclick="javascript:history.back();">back</a>
I used to do it this way until it turns out that this is not working under Firefox.
Fortunately I found the solution while I was reading an article posted at Code Project website. The back button there was working even in Firefox. The code used is really simple:
<a href="javascript:history.back();">back</a>
Enjoy!
back, back link, Firefox javascript







This is that I was looking for, it works very well
Thank you very much!!
I know this is old entry, but I was facing the same problem. Ended up here after some google and the solution here made me thinking what is the real cause due the “fix” suggested here.
The real problem is that with code:
back
Firefox is executing the onclick, however Firefox is still executing the anchor link as well and moving the page to top. This cancels the history.back(). Now with proposed solution:
back
Firefox is just executing the anchor link, which in this case is entered as javascript block. All fine, and Firefox executes the history.back() as intended. However if you want to use the onclick and have that code work, you just have to tell Firefox not to execute the anchor (as originally intended):
back
Note the added “return false;”.