Closed Thread Icon

Preserved Topic: window.close (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=8510" title="Pages that link to Preserved Topic: window.close (Page 1 of 1)" rel="nofollow" >Preserved Topic: window.close <span class="small">(Page 1 of 1)</span>\

 
butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 02-04-2003 00:56

Hi guys,

I'm opening a popup window from one page like this:

code:
//Written by Bitdamaged
function openWin() {

URL = '/includes/multimedia/upload_progress.html';
escape(URL);// Cleans things up
progressWindow = window.open(URL,'progress','height=100,width=250,resizable=no,titlebar=yes,menubar=no,status=no,scrollbars=no,toolbars=no,location=no');
}



That works just fine, the problem comes when I try to close the window. The widow pops in the onclick method when I submit a form on one page, and I want to close the window from the page the loads after the form is done submitting.

I'm trying to do it like this in the onload of the new page:

code:
<body onload="progressWindow.close();">



but it seems no matter what I try (not that I'm making educated guesses here) I can't seem to close the popup from the new page.

As always any help or guidance is appreciated!!



-Butcher-

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 02-04-2003 01:04

Well, the problem is, when a new page loads, all of your JavaScript variables are lost. So progressWindow no longer refers to the open window.

There might also be security restrictions, but if the new page is on the same site, I wouldn't expect that to be a problem.

You might have better luck trying to get the opened window to check the window loading the page to see if it's loaded or not.

butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 02-04-2003 01:23

Thanks very much Slime!

You got me thinking and I can accomplish what I want if I close the window on unload.

Thanks again for the nudge in the right direction.

-Butcher-

DmS
Paranoid (IV) Inmate

From: Sthlm, Sweden
Insane since: Oct 2000

posted posted 02-04-2003 13:43

Not sure if I got this right bu this is how I did it when I had a main-application window that spawned sub-applications in their window.

If you clicked logout in the sub windows you should get focus on the opener, but if the user had closed that one you should stay in the subwindow.

first this little bugger in the main window:

code:
function isAliveCheck(){
this.alive = "yes";
}


Then in the function that opens the sub-windows you do this first:
isAlive = new isAliveCheck();


Then from the subwindow you can check if the opening window is open like this:

code:
function checkOpener(){
if(!window.opener.isAlive){
alert("Opener is not alive");
}else{
window.opener.focus();
}
}



If I'm not mistaken here "isAlive" is connected to "navigator" and should hold it's value even if you load a new page. Or...
Havn't tested that one yet...
/Dan

{cell 260}
-{ a vibration is a movement that doesn't know which way to go }-

butcher
Paranoid (IV) Inmate

From: New Jersey, USA
Insane since: Oct 2000

posted posted 02-04-2003 14:17

Thanks DmS, I may have to mess around with that and see if I can make it work.

All I really wanted to accomplish with this was a file upload indicator that stayed up as long as the file
upload actually took without working out the file size and estimating the time it would take to upload.
I will put some type of "uploading your files" animation in the popup that pops when the user clicks the
submit. Since the main window never actually closes until the upload is done, I can then use the
onunload to close the popup. It will at least give users the indication that something is actually happening
on long uploads (zip files and such) and hopefully keep them from clicking things again because they don't
think anything is happening.

Thanks for the replies guys.

[edit] Just cutting down the line lengths so you don't have to scroll right [/edit]

-Butcher-


[This message has been edited by butcher (edited 02-04-2003).]

« BackwardsOnwards »

Show Forum Drop Down Menu