This code works fine in FF, it takes the user back to the previous page, but not in Chrome:
<a href="www.mypage.com" onclick="javascript:history.go(-1)"> Link </a>
What's the fix?
This code works fine in FF, it takes the user back to the previous page, but not in Chrome:
<a href="www.mypage.com" onclick="javascript:history.go(-1)"> Link </a>
What's the fix?
javascript:history.go(-1);
For example :
Try this dude,
Try this:
Why not get rid of the inline javascript and do something like this instead?
Inline javascript is considered bad practice as it is outdated.
On jsfiddle
Use the below one, it's way better than the
history.go(-1)
.You should use
window.history
and return a false so that thehref
is not navigated by the browser ( the default behavior ).