jeesrinu
asked on
How to close a window in javascript(Mozilla)
Hi,
i am using below code to close the window in javascript. It is working in IE .But it is not working in Firefox version 3.5.3 .
Anybody please tell the solution how can i made changes to my code to work in mozilla.
Thanks in Advance.
i am using below code to close the window in javascript. It is working in IE .But it is not working in Firefox version 3.5.3 .
Anybody please tell the solution how can i made changes to my code to work in mozilla.
Thanks in Advance.
<html>
<body bgcolor="#FFFFFF">
<a href="javascript:window.close();">Close This Window</a>
<br>
<form>
<input type=button value="Close This Window" onClick="javascript:window.close();">
</form>
</body>
</html>
Hi
That is the correct command, so it's quite possible that it is blocked for security purposes. Normally you can only close a window which you opened in your code, else the user gets a prompt saying that the program is requesting a window close. Is it a window your code has opened, or is it the main browser window?
That is the correct command, so it's quite possible that it is blocked for security purposes. Normally you can only close a window which you opened in your code, else the user gets a prompt saying that the program is requesting a window close. Is it a window your code has opened, or is it the main browser window?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you can take a look at it from the simple code in my blog. you also will not see the yes or no option when you close with this method.
http://kadirselcuk.wordpress.com/2009/04/14/close-current-window-or-parent-window-in-javascript-without-that-ugly-confirm-prompt/
http://kadirselcuk.wordpress.com/2009/04/14/close-current-window-or-parent-window-in-javascript-without-that-ugly-confirm-prompt/
try with only window.close()
<html>
<body bgcolor="#FFFFFF">
<a href="#" onclick="window.close();">Close This Window</a>
<br>
<form>
<input type=button value="Close This Window" onClick="window.close();">
</form>
</body>
</html>
ASKER
It is not working in mozilla
Quote from mozilla: https://developer.mozilla.org/en/DOM/window.close