button (button) Close the way to return to the previous page

 1. JavaScript returns to the previous page code difference:

  1. window.history.go(-1);  //返回上一页
  2. window.history.back();  //返回上一页
  3. 如果要强行刷新的话就是:window.history.back();location.reload();
  4. window.location.go(-1); //刷新上一页

 

 2. The js code to close the window without any prompt

<a href="javascript:window.opener=null;window.open('','_self');window.close();">关闭</a>

 3. Custom prompt close

<script language="javascript">
// This script is a common script for ie6 and ie7
function custom_close(){
if
(confirm("Are you sure you want to close this page?")){
window.opener=null;
window.open('','_self');
window.close();
}
else{}
}
</script>

<input id="btnClose" type="button" value="关闭本页" onClick="custom_close()" />

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326581918&siteId=291194637