How would I keep music playing on a website as a user navigates it?

1.3k views Asked by At

Not that I wanna do it anytime soon but I do wanna know how it's done. When a website has music, it usually stops playing after you navigate to another page on the site, and then it starts playing again when that page loads.

How would I keep the music playing even if the user clicks on a link? I don't wanna put my website on a frame.

And also, if they open a new tab of the website how would I stop the song from replaying on that tab if they're already playing it?

3

There are 3 answers

3
jpstrikesback On

Method 1:

  • A flash website.

Method 2:

  • Frames (1 frame with player, other with navigable site)

Method 3:

  • The future

Method 4:

  • Everything on a Single Page, content loaded by ajax...possible, but not cool for SEO at the mo

As far as active browser tab say you were using jQuery you can check that using window.focus & window.blur events:

$(window).focus(function() {
    //dothisandthat;
});

$(window).blur(function() {
    //dothatandthis;
});
0
andrew On

I found a basic method that I got working. So this is the home page. But really its not. This page just loads your music and home pages into the same window.

<html>
<head>
<meta charset="UTF-8">
</head>
<frameset cols="21%, 79%">
<frame src="music.html" />
<frame src="home.html" />
</frameset>
</html>

Then change any links in your website to this format

<a href="page2.html" class="Big_Text">Random Page Name</a></td><br />

My website has this embedded

0
Paul Feakins On

Method 5:

  • Write browser extensions which the user can install before browsing. Of course you would have to write them for all major browsers but none of these suggestions are particularly nice.

Method 6:

  • Open a popup window with the music player in.

Method 7:

  • Open a new tab with the music player in.