Manuel Manuel - 8 months ago 58
jQuery Question

jquery: history.back(1) issue

I have an issue with jquery and history.back(): I got a link:

<a href="#" id="backLink">Link back</a>

I cant use something like href="javascript:history.back()" as the CMS used is blocking inline JS (for whatever reason).

So I place a JS like this:

$("#backLink").click(function() {

But this does not seem to work! On Safari and Chrome no problem, but on FF, IE this link is not working!

Is there a way how to use this for all browsers - or is there some mistake in the above code?

Thanks in advance!

Answer Source

Probably you are missing to specify event as function argument, try specifying that too:

$("#backLink").click(function(event) {

In other words, you had problem on event.preventDefault(); which most likely prevented below code from running or working.