1. JavaScript returns to the previous page code difference:
-
window.history.go(-1);
//返回上一页
-
window.history.back();
//返回上一页
-
如果要强行刷新的话就是:window.history.back();location.reload();
-
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()" />