Hello,
This is the same problem many have, with a slight twist:
The home page of the site opens a child window that plays a flash movie. This movie is a song by the artist that owns the site, so it needs to stay running even if the user goes back to the home page.
No problem there, I set a cookie; if the cookie is set, I don't re-open the window.
The problem comes in with some additional code that I added to account for anyone who has closed the window.
In a nutshell, even if the cookie has been set, I want to check to make sure the child window exists and hasn't been closed. This is the problem, since there will be no variable set to reference the child window if the user comes back to the page (because the cookie tells the page not to re-open the window).
Hopefully this is not too confusing. Here's the relevant code bits:
function openpopup(){
var popurl="test.html"
winpops=window.open(popurl,"popwindow","width=260,height=250,left=500,top=250"
}
//inside cookie-checking; we have a cookie, look for window
if ((!winpops) || (winpops.closed) ) {
openpopup();
}
That last check there is what is problematic. "winpops" won't exist. Originally I had a winpops var set to null above all the other javascript, but of course this means that the test will always evaluate true, and open the window every time the home page is loaded.
Anyway, thanks for any help you can provide. Frames are out of the question for this particular site.
Rick
This is the same problem many have, with a slight twist:
The home page of the site opens a child window that plays a flash movie. This movie is a song by the artist that owns the site, so it needs to stay running even if the user goes back to the home page.
No problem there, I set a cookie; if the cookie is set, I don't re-open the window.
The problem comes in with some additional code that I added to account for anyone who has closed the window.
In a nutshell, even if the cookie has been set, I want to check to make sure the child window exists and hasn't been closed. This is the problem, since there will be no variable set to reference the child window if the user comes back to the page (because the cookie tells the page not to re-open the window).
Hopefully this is not too confusing. Here's the relevant code bits:
function openpopup(){
var popurl="test.html"
winpops=window.open(popurl,"popwindow","width=260,height=250,left=500,top=250"

}
//inside cookie-checking; we have a cookie, look for window
if ((!winpops) || (winpops.closed) ) {
openpopup();
}
That last check there is what is problematic. "winpops" won't exist. Originally I had a winpops var set to null above all the other javascript, but of course this means that the test will always evaluate true, and open the window every time the home page is loaded.
Anyway, thanks for any help you can provide. Frames are out of the question for this particular site.
Rick