[JS]-Disable webpage [compatible with IE6, IE7, IE8, FF, chrome]

Source: Internet
Author: User

Source: http://hi.baidu.com/wr5532/blog/item/b3546037ca99423c0b55a96a.html

 

Dialog Box with confirmation:

  <  Script  >  
If (Confirm ( " Are you sure you want to close this page? " ))
{
Self. Opener = Null ;
Self. Open ( '' , ' _ Self ' );
Self. Close ();
}
</ Script >

Close directly without prompting:

  <  Script  >  
Self. Opener = Null ;
Self. Open ( '' , ' _ Self ' );
Self. Close ();
</ Script >

 

 

 

Note:

 

TheseCodeSometimes it does not work under ff, and the system prompts "Do Not Allow scripts to close pages that are not opened by scripts". You need to modify the FF settings and

The method is as follows:

Open Firefox and enter about: config in the address bar.

Find Dom. allow_scripts_to_close_windows and change it to true.

 

========================================================== ==================================

 

Supplement:

Window. Close ();

In Chrome, there is no response, and FF is directly disabled without asking.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.