JS Close Window no prompt, print

Source: Internet
Author: User

 

If you press window. Close () on a page that is not opened by JS, there will be a prompt box, which is annoying. Now you don't need it. Close the window without a prompt box.
Try the following:Code:

<Object ID = "webbrowser" width = 0 Height = 0 classid = "CLSID: 8856f961-340a-11d0-a96b-00c04fd705a2">
</Object>
<Input type = "button" name = "button" value = "Close Window" onclick = "document. All. webbrowser. execwb (45,1)">
If you try to change the parameters, you will get some other functions:

Webbrowser. execwb () Open
Webbrowser. execwb () Close all existing IE Windows and open a new window
Webbrowser. execwb () Save the webpage
Webbrowser. execwb (6, 1) print
Webbrowser. execwb (7,1) print preview
Webbrowser. execwb (8, 1) print page settings
Webbrowser. execwb (10, 1) view page properties
Webbrowser. execwb () seems to be undo, to be confirmed
Select All webbrowser. execwb (17,1)
Webbrowser. execwb (22, 1) Refresh
Webbrowser. execwb () Close form no prompt

Another method is to close the window without prompting:

<Input type = "button" value = "the message" onclick = "window. Opener = NULL; window. Close ();"/>

 

Supplement:

The same statement is normal in IE6. In IE7, the prompt before closing the window is displayed.

This code is very simple. Please use it:
<A href = "#" onclick = "window. opener = NULL; window. open ('', '_ Self'); window. close (); "> close not confirmed </a>
That is, add window. Open ('', '_ Self') between window. Opener = NULL; window. Close ');
OK!

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.