PDA

View Full Version : window.close() is not working in FF



hasankaz
04-25-2008, 02:36 PM
Hi,
Its seems v.silly question but I cant close Firefox window using
javascript:window.close(); command, anyone have a solution for this please advise...
thanks in advance
regards
Kazmi~

Nile
04-25-2008, 02:39 PM
Either one of these should work:

<button onClick="window.close()">Close Window</button>

<a href="javascript:window.close()">Close Window</button>

hasankaz
04-25-2008, 02:57 PM
Thx Nile but all these commands are working only with IE but not with Firefox. I've tried all these

1- <a href="javascript:self.close();">Close </a>
2- <a href="javascript:window.close();">Close </a>
but no luck........

Nile
04-25-2008, 03:14 PM
It must be your settings, make a page(html) and put this in:


<script>
alert('Javascript is enabled');
</script>
<noscript>Javascript is disabled</noscript>

Tell me the output.

hasankaz
04-25-2008, 03:19 PM
Lol strange..... Javascript is enabled as well nothing wrong with browser as its newly downloaded and being busy on lots on testing and development and all function perfect.....let me search as well......... thx for your time, did you test this on your firefox ?

Nile
04-25-2008, 03:24 PM
Yes, I did any it worked what version do you have as I have FF 2.0.0.14

hasankaz
04-25-2008, 03:27 PM
Yup same version, i even upload the script to test, cause i feel like it might be cause im local (although thats sounds stupid) ......

Nile
04-25-2008, 03:31 PM
Hmm, try downloading it again, although I don't think it will work, but if you contact Mozilla, they'll probably tell you the same thing. So reinstall it, if it still doesn't work contact them.

rangana
04-26-2008, 02:58 AM
No, there's no problem in FF, the problem is in Javascript itself :)

In FF, window.close() will never close, not unless you opened that window through window.open method ;)

For further reading:
http://developer.mozilla.org/en/docs/DOM:window.close

Hope that helps ;)