The small series was originally written History.back () as follows
Htm
<div class= "btn1" ><a href= "#" id= "Calcelbtn" > Cancel </a></div>
JS Code
$ (' #calcelbtn '). Click (function () {
History.back ();
})
After testing found in IE can be used, in Firefox and Chrome is invalid, and later Baidu found to be in accordance with the following method will be in Firefox and Chrome invalid support.
FireFox:
Only need to change to the following way:
<a href= "#" onclick= "Window.history.back ()" > Return </a>
Chrome:
Chrome is more difficult than Firefox:
<a href= "#" onclick= "Window.history.back (); return false; > Return </a>
Analysis: For Chrome, the first execution of Window.history.back (), after the completion of the execution href= "#", so cannot return. Plus return false will no longer execute href= "#" Okay, let's do some repairs.
$ (' #calcelbtn '). Click (function () {
Window.history.back ();
return false;
})
All right, that's it. Oh, let's go and have a try.