My problem is this: I want to pop open a window when a user visits my site but only if that window isn't already opened. This presents a problem obviously with the user changing pages. I can set a variable in JavaScript but of course once I navigate away, that variable is non-existent again. I need this because the window plays some music, but right now it pops that window up for every page load, even if the window is open, thereby refreshing it and repeating the songs which I want to keep playing, not restart.

I was looking into using cookies to do this but I want to know if it's possible and this seems like the best place to ask. My idea is, upon page load of any page on my site, check to see if a cookie is set, a name of my choosing. If so, then I would pop open my window. If it is set, I'd not run the function to pop open the window. I would also want the cookie to have a time set on it, like let's say 10 minutes, so that if the user wants to come back to the site, it would still pop that window up, if they haven't cleared their cookies yet.

Even further, if the user closes the player window, or their entire browser, is there a way to clear the cookie then or do I just have to use expiry to do this?

Is this feasible, and if so, is it a lot of work? Thanks!