Results 1 to 8 of 8
Thread: window.close() on Firefox
-
11-30-2008, 12:09 PM #1WHT Addict
- Join Date
- May 2008
- Location
- USA
- Posts
- 124
Hello,
I created a web page include a button, and I added onclick event on the button to close the window, but the button works well on IE, but it doesn't work on Firefox
any help??
-
11-30-2008, 12:30 PM #2Junior Guru Wannabe
- Join Date
- May 2008
- Location
- London
- Posts
- 33
Tell us what the error is? Use something like FireBug to see it if you can't already.
Jay
-
12-01-2008, 06:07 AM #3WHT Addict
- Join Date
- May 2008
- Location
- USA
- Posts
- 124
Hi Jay,
It doesn't return any error
my code as the following:
<html>
<head>
</head>
<body>
<input type="button" value="close" onclick="window.close();"/>
</body>
</html>
I read somewhere while I was searching that in Firefox I can't close a window via javascript unless I open it via javascript
-
12-03-2008, 01:29 AM #4HivelocityDD Guest
Can you please try this
onclick=\"javascript:window.open('','_parent','');window.close();\"
This should work both with IE and firefox
Cheers !
-
12-03-2008, 03:15 AM #5WHT Addict
- Join Date
- May 2008
- Location
- USA
- Posts
- 124
nop,
It didn't work
-
12-03-2008, 06:31 AM #6HivelocityDD Guest
If you are using older version of firefox it should work. But for higher versions above 2.2 it wont work I think.
Can you please try this
<input type="button" value="close" onclick="javascript:window.opener='x';window.close();"/>
Let me know if you have any luck with this please..
-
12-03-2008, 07:05 AM #7WHT Addict
- Join Date
- May 2008
- Location
- USA
- Posts
- 124
no good news, not working
-
12-03-2008, 02:28 PM #8Junior Guru
- Join Date
- Feb 2006
- Location
- top: 50px; left: 200px;
- Posts
- 213
I read somewhere while I was searching that in Firefox I can't close a window via javascript unless I open it via javascript
Thats correct
To use the close method in FF you must use the open method..