History.Back with refresh

前端 未结 2 739
余生分开走
余生分开走 2020-12-07 23:13

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

相关标签:
2条回答
  • 2020-12-07 23:31

    You can also use the location replace() method:

    window.location.replace(document.referrer)
    
    0 讨论(0)
  • 2020-12-07 23:53

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

    i.e.

    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();
    }
    
    0 讨论(0)
提交回复
热议问题