简体   繁体   中英

History.Back with refresh

I would like to have the History.back(); functionality with a complete refresh of previous page.

Any idea how to do that (and make it work in IE, FF and Chrome).

You could redirect (by window.location) to document.referrer

ie

window.location.href = document.referrer;

Internet Explorer fix for passing referrer to a particular location:

if(IE){ //IE, bool var, has to be defined
    var newlocation = document.createElement('a');
    newlocation.href = URLtoCall;
    document.body.appendChild(newlocation);
    newlocation.click();
}

您还可以使用location replace()方法:

window.location.replace(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