help: How to auto close pop up when finished.

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
camarosource
Forum Commoner
Posts: 77
Joined: Sat Aug 03, 2002 10:43 pm

help: How to auto close pop up when finished.

Post by camarosource »

We want to have it so when a HTML form is submitted (a person is uploading a picture) that a Javascript will open a pop up window and then automatically close the window once the file is sent sucessfully.

See, we use like it's w = window.open(blah blah to open and w.close() to close but when the form is submitted w gets destroyed, so we need a way to close it without w or pass w to the next page or need a way for the popup to check when form is done submitting so it can close itself

Does anyone know a good way to do this?

Thanks
User avatar
delorian
Forum Contributor
Posts: 223
Joined: Sun May 04, 2003 5:20 pm
Location: Olsztyn, Poland

Post by delorian »

In the document which will be opened in that pop-up window. You should put the following line:

Code: Select all

<body onLoad="window.close();">
If I catch what you're up to. :D
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

A reminder, that you can pass variables using $_GET (http://example.com/page.php?something=here) also, that later can be inserted into javascript. Might be useful.
User avatar
Vincent Puglia
Forum Commoner
Posts: 67
Joined: Thu Sep 04, 2003 4:20 pm
Location: where the World once stood

Post by Vincent Puglia »

Hi,

Sorry, I didn't fully understand the problem this morning in the other forum.

in the original page:
w = window.open('w.html');
location='x2.html'

in the x2 page:
nothing relevant to the problem

in the w document:
function doit()
{
if (opener.location.toString().indexOf('x2.html') != -1) this.close();
setTimeout('doit()', 1000);
}

setTimeout('doit()', 1000)

Vinny
Post Reply