window history back (-1) not working

后端 未结 2 1335
误落风尘
误落风尘 2021-01-23 21:25

I have use below code to back for the previous page, but it\'s not working. the alert box still popup even i click ok on the page. actually there have 3 page include this windo

相关标签:
2条回答
  • 2021-01-23 21:52

    Use: window.history.back() instead .go();

    http://www.w3schools.com/jsref/met_his_back.asp

    or use:

    window.alert("Please choose Type of Redemption");
    setTimeout(function(){
      window.history.go(-1);
    },500);
    
    0 讨论(0)
  • 2021-01-23 21:53

    I would always avoid using alert(), since it kills script in some Browsers. I would open() a new window and ButtonElement.onclick use location =.

    Note:

    window is implicit, so you don't need to write window.open() or window.location. Additionally, it's fine to leave off .href when referring to location.href

    0 讨论(0)
提交回复
热议问题