Sunday, August 2, 2009

Javascript Cross Browser Back Method

I have been working on a quick CROSS browser "back" method in JavaScript. It is really simple...

The history.go(-1) only worked well in IE. This double method worked well in IE, Firefox and Chrome. It checks if it knows how to do the "referrer" method. If not... it uses the history.go

[a href="#" onclick="if(document.referrer) {,'_self');} else {history.go(-1);} return false;"]continue shopping[a]

Of course, you should use a "<" instead of "[" ... Blogger had issues when I posted the full link.

1 comment:

  1. Perfect! This is exactly what I was looking for to get a Back link working in IE, Firefox, Safari, and Chrome.