Ok heres the deal. I have a music page that has a mp3 player on it. Then I have a link to 'detach' the player which just opens the play in a new window then it throws the user to the home page or whatever. The problem is that if that user goes back to the music page while the player is 'detached' then the music player loads again and they both stop working.
So my idea is when the music page is loaded, it checks if the window "MusicPlayer" exists. If it does exist, then I do nothing. Otherwise I open the music player on the page. I have tried such things as:
if (MusicPlayer && MusicPlayer.open && !MusicPlayer.closed)
{
alert('win!');//i would NOT include the player
}
else
{
alert('lose');//i would include the player
}
but that does not work as it just says that MusicPlayer is not set yet in my error console even though that window is open.
Last I remember, that's not possible. I'm guessing you did this with Java? There should be a way for you to know if the player is still open through it.
Edit: worst case, you could use a cookie as a flag.
no i am using a flash program as the music player so the first parts out.
The cookie thing: Can I make a cookie that will only persist while that one window is open? would a session cookie do that or do session cookies persist while the browser is open, even if it was set in a popup?
Edit:
Burr: that would not work because if i left the page then came back while the window was still open then newwin would always be false.
shiznatix wrote:Burr: that would not work because if i left the page then came back while the window was still open then newwin would always be false.
not sure I follow you here...newwin doesn't get set back to false until the window is closed (onUnload). the window losing focus doesn't do anything...did I misinterpret that?
shiznatix wrote:Burr: that would not work because if i left the page then came back while the window was still open then newwin would always be false.
not sure I follow you here...newwin doesn't get set back to false until the window is closed (onUnload). the window losing focus doesn't do anything...did I misinterpret that?
the page that initiates 'newwin' will change. I open the newwin, then on the page that loaded that I go and do a bunch of stuff then somehow link back to the page that can load newwin. Now that I am back, newwin equals null again since I reloaded the page.