SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
-
Sep 24, 2007, 03:49 #1
- Join Date
- Nov 2005
- Posts
- 496
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Is there anyother way of closing a window?
A friend of mine is developing a web site, and at the moment he is using the usual window.close() me-larky to close a pop up window... But in Internet Explorer it comes up with a warning about 'this is trying to close the window' or something like that... Is there anyway around this, so this IE error message doesn't appear?
Many thanks for any input.
-
Sep 24, 2007, 04:36 #2
- Join Date
- Oct 2004
- Location
- Birtley, UK
- Posts
- 2,439
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
instead of window.close(); use
Code:var self = this; self.close();
-
Sep 24, 2007, 12:53 #3
- Join Date
- Sep 2005
- Location
- Sydney, NSW, Australia
- Posts
- 16,875
- Mentioned
- 25 Post(s)
- Tagged
- 1 Thread(s)
The warning only comes up if you try to close a window you didn't open. Other browsers wont produce the warning and will just ignore the code instead.
JavaScript can only close a window that was opened using a JavaScript window.open() call.Stephen J Chapman
javascriptexample.net, Book Reviews, follow me on Twitter
HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
<input name="html5" type="text" required pattern="^$">
Bookmarks