Question: Q: How can I disable the pop-up dialog window by calling window. Close () in JS?
Original Discussion link:Http://community.csdn.net/expert/topicview1.asp? Id = 3670997
Forum:JavascriptAudit Team:Web Development
Questioner:Hwh215Released:Meizz
Thanks:Meizz, meizz, qjrein
Keywords:Javascript web development
Answer:
Big brother:
On the webpage, I use js to call window. Close () to close the current window. However, a dialog box is displayed in the browser asking if I want to close the window. How can I avoid this dialog box and close the current window directly?
---------------------------------------------------------------
Add one more sentenceCode:
Window. Opener = "meizz"; // ie5.5 +
Window. Close ();
---------------------------------------------------------------
<! -- Ie5.5 or above -->
<Object ID = webbrowser classid = CLSID: 8856f961-340a-11d0-a96b-00c04fd705a2 Height = 0 width = 0> </Object>
<Input type = button value = print onclick = "document. All. webbrowser. execwb (6, 1)">
<Input type = button value = print onclick = "document. All. webbrowser. execwb (6, 6)">
<Input type = button value = page setting onclick = "document. All. webbrowser. execwb (8, 1)">
<Input type = button value = print preview onclick = "document. All. webbrowser. execwb (7,1)">
<Input type = button value = Enable onclick = "document. All. webbrowser. execwb (1, 1)">
<Input type = button value = save as onclick = "document. All. webbrowser. execwb (4,1)">
<Input type = button value = attribute onclick = "document. All. webbrowser. execwb (10, 1)">
<Input type = button value = select all onclick = "document. All. webbrowser. execwb (17,1)">
<Input type = button value = Refresh onclick = "document. All. webbrowser. execwb (22,1)">
<Input type = button value = Close Window onclick = "document. All. webbrowser. execwb (45, 1)">
---------------------------------------------------------------
Window. openner = NULL;
Window. Close ();