开发者

Go back Javascript not working for Safari

开发者 https://www.devze.com 2023-03-03 23:15 出处:网络
I am trying to implement a go back button using javascript. The code below works fine for ie and firefox. It doesnt work for safari though. Any ideas to fix the problem?

I am trying to implement a go back button using javascript. The code below works fine for ie and firefox. It doesnt work for safari though. Any ideas to fix the problem?

<A href="javasc开发者_开发技巧ript:history.back()"><IMG border=0 src="imageurl1"></A>`

 I tried history.go(-1) as well. 

Thanks,


You can try making a function with preventDefault like this:

function goBackHistory(){
  history.go(-1);
  event.preventDefault();
}

and then call function from html

<a href="javascript:goBackHistory()"><IMG border=0 src="imageurl1"></a>
0

精彩评论

暂无评论...
验证码 换一张
取 消