PDA

View Full Version : close browser windo


Zardoz
12-12-2002, 08:02 PM
I know I've seen this before, and I even tried searching but couldn't find it in the hundreds of hits.

I need a js code that closes the browser window after a person clicks the "submit" button of a form so the window doesn't hang around. Any help would be appreciated!

pilla
12-12-2002, 08:18 PM
Could be something like this:

<input type="submit" value="Enviar" onClick="window.close()">

Zardoz
12-12-2002, 08:52 PM
Thanks! That's exactly what I wanted. Is there no way to remove the "click to close the window" warning that popsup?

Roy Sinclair
12-12-2002, 09:22 PM
The way to get rid of the "Click to close window" message is by creating the window yourself. Instead of trying to close the user's original browser window you should create a new window for your form and then when the user has submitted the form you can silently close that additional window leaving the user with their original window to continue browsing (you can even have a response to the submit passed to that original window).

That's the right way to do this, it's rude to close the user's main browsing window which is why the prompt comes up.

Zardoz
12-12-2002, 09:31 PM
That's strange - because that's exactly what I did. A new window opens with the form (the original broswer window is beneath it). Then I want to close that form. Is that what you are describing?

Roy Sinclair
12-12-2002, 09:41 PM
If that's what you're doing then you shouldn't be seeing that prompt (and bless you for thinking of the end user :thumbsup: ).

What browser (make(s) and version(s)) do you see this with?