This one has me pretty tangled. I’ve scaled the code down for gut level editing.
Basically, my site has two windows. One is a frame and the other, a popup. Both play my webcast. Because popup blockers (a good thing) will block my popup, I start with audio from my webcast in the frame. There is a button which will open the webcast in a non-blocked popup.
If they open the window, the frameset automatically stops playing. If they close the popup, the frameset reloads and plays again.
The problem: if the popup is open and the visitor closes the main window (opener window) I get an error message “permission denied, code 0”.
I think this is because the webcast window is trying to load the frameset location … but the frameset no longer exists because the window has been closed. 😮
Can anyone help me find a solution to rid me of the error message?
[CODE]var alternate = “null”;
if (window.name == ‘webcast’) alternate = opener.parent.hidden; // hidden is the name of the opening window
// at page UNLOAD
window.onunload = function()
{
if (window.name == ‘webcast’ && alternate.location.href == “http://www.robindean.com/index.php?play=false”) alternate.location.replace (‘index.php?play=webcast’);
if (window.name == ‘hidden’ && !webcast.closed && webcast.location && window.location.href == “http://www.robindean.com/index.php?play=false”) webcast.close();
}