Forum Moderators: open
Does anyone know how to go about enabling the pop up with the following criteria?
1) Windows stays in front of other windows at all times except when minimized is clicked.
2) Window uses the body onload() funtion but does not get blocked by pop up blockers.
3) If the click here to play trigger link is clicked, the music player window will come to the front and not reload (This would cause the music to start over if reloaded).
4)Would work for cross browser applications.
Here is what I have so far.
<SCRIPT TYPE="text/javascript">
<!--
function popupnr(mylink, windowname, refocus)
{
var mywin, href;if (typeof(mylink) == 'string')
href=mylink;
else
href=mylink.href;
mywin = window.open('', windowname, 'width=287,height=107,left=350,top=300,scrollbars=no');
// if we just opened the window
if (
mywin.closed ¦¦
(! mywin.document.URL) ¦¦
(mywin.document.URL.indexOf("about") == 0)
)
mywin.location=href;
else if (refocus)
mywin.focus();
return false;
}
//--></script>
Thanks.
Regarding (2) the trick is to let the user activate the popup using a click on a link or a button. You've got that already, so skip the unload(). If that page is loaded from a link on another page you can put a window.open() on that link in stead (the one leading to the page).
Regarding (3) Edit: The original sentence came out very badly, sorry about that. And perhaps what i thought about isn't at all necessary. Afaik, if you have an open named window, and that named window is re-activated by a click on a link, it will automatically jump to the front (i might be wrong here, though).
Then, all you have to do is to check if the window exisits before you activate it, and if so, send some variable in the call to it, and grab that variable in a scipt in the window itself, to make sure the music don't stop.
Regarding (4), use only javascript functions that are supported in firefox. That should help you a lot. Then, when everything is working perfectly, tweak for IE if it's necessary.
Btw.: Welcome to WebmasterWorld cdm123 :)
[webmasterworld.com...]