JS refresh window, close windows

First, refresh windows.

  

document.location.href=document.location.href;

Two. Close the window.

1、 Close the window without any hints.

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

2、Custom prompt closure

<script language="javascript">
// This script is a generic script for IE6 and IE7.
function custom_close(){
if 
(confirm("Are you sure you want to close this page? ")){
window.opener=;
window.open('','_self');
window.close();
}
else{}
}
</script>  
 <input id="btnClose" type="button" value="Close the page "onClick=" custom_close () "/>";

 

Leave a Reply

Your email address will not be published. Required fields are marked *