PDA

View Full Version : closing browser windows



teemflmngo
09-27-2006, 07:39 PM
I am trying to design a site that opens a specifically sized window. I have a script in my "index.html" that opens the new window, and everything is good, except I need to also close "index.html" so that it doesn't just sit there in the background. I tried "window.opener.close();", but it doesn't work with Firefox and IE wants to ask if I really want to close the other window. Does anyone know of a better way to close the first window?

Tominator
09-29-2006, 06:46 PM
Did you try this yet as a link?
javascript:window.close()

jscheuer1
09-30-2006, 06:58 AM
Windows not opened via javascript cannot be closed via javascript. This is not some cosmic law but, rather the way security on the web has evolved in most current browsers.

There is a way around it in IE but, as far as I know, not in any other modern browsers.

I would question the necessity and wisdom of opening any particularly sized window though. If it is for design purposes, you would be much better off designing your page(s) differently so that they do not depend upon a particularly sized window as, the size you choose will always end up being unsuitable for some users for some reason or another and many browsers (including IE with certain common security settings) will not even allow you to open it in the first place.