Forum Moderators: open

Message Too Old, No Replies

Pop Up Music Player?

window with a number of features

         

cdm123

9:03 am on Dec 31, 2004 (gmt 0)

10+ Year Member



I am creating an music site and have embeded windows media player in to a pop up window for vistiors to listen to streaming radio and also playlists.

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.

claus

10:36 am on Dec 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Regarding (1) there's no way you can do that. Oh, (second thoughts) perhaps there is after all, but it would not be the right thing to do, as it would be extremely annoying. Imagine that a user brings some other window to the front to get some work done and your window just pops right in front of it. I would close it instantly if i was the user, and that's probably not what you want ;)

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 :)

cdm123

8:35 pm on Dec 31, 2004 (gmt 0)

10+ Year Member



Hi claus,

Thank you very much for the welcome and the useful info.
This helps out a lot.

Have a great new years.

claus

8:21 pm on Jan 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This thread has an example of sending a variable to a pop-up window, btw:

[webmasterworld.com...]

cdm123

3:47 am on Jan 2, 2005 (gmt 0)

10+ Year Member



Thanks for the additonal info.

Happy New Year.