Friday, November 27, 2009

Stop 'close window' prompt in ie with HTML?

When you put a 'close window' button within a webpage, you get the message 'The webpage you are viewing is trying to close the window' is there any way to do the HTML so that you don't get this prompt or is it an ie setting.



Stop 'close window' prompt in ie with HTML?ie 7





no this is just a simple javascript tag.



simply write



javascript:window.close()



and use as a link or as a button!



Stop 'close window' prompt in ie with HTML?ireland internet explorer



The prompt is a security feature of the browser to prevent scripts from annoyingly closing the window. So no you can't and shouldn't get rid of it.
If you open a window, then you may close it without the prompt.. but otherwise the browser will complain.. because you should not be closing, or trying to close a window that you did not open.
window.close() will not work, it will still prompt you. You have to use window.opener=top;window.close();



If you're using Vista/IE7, it will still prompt though. This only works for non Vista/IE7 configurations.
window.close() works without giving a prompt if you open up a new window.



The current window(with your history/ and back button) won't close automatically so you won't lose the previous page you visited. So any window will close automatically without the prompt, if it's not the main window browser.
As said above, the script window.close() will work, but ONLY if the opened window is NOT the INITIAL window (the first one you opened typing the URL).



So, ok for a pop-up or a link opening with "target=_blank".



ie:



%26lt;a href='somepage.htm' target='_blank'%26gt;the link%26lt;/a%26gt;



Then, in "somepage.htm", the script "window.close()" will work.

No comments:

Post a Comment

 
loan