简体   繁体   中英

How to work History.back() in IE8 and above Versions

I'm facing a big issue related to "Back Button", Currently I am using JavaScript back button like - parent.history.back(); but it is giving error like "Webpage has expired" on clicking Back button. is there any solution to get rid of it. My Project is in Asp.net.Every comment is appreciated. Thank you..!

Here is a working example (tested on saucelabs IE7, IE8, IE9 @Windows XP and Vista)

<input type="button" id="push-me" value="Push me!" onclick="window.history.back(); return false;"/> 

If it still doesn't work for you may ensure that your tests are not executed within an iframe but a separate window.

It is probably a syntax error.

onclick="history.go(); return false;" 

or

onclick="history.go(-1); return false;" 

should work. Else you could try document referrer instead:

location.href = document.referrer;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM