(note: I really try to be one of those people who provide useful answers, even when the end goal might be something I personally disagree with, but this is a special case. Background music on websites is like ie6 - to be avoided like the plague and exterminated where it has somehow retained a foothold. Please don't do it, I beg you. And if the client insists, make sure that you've informed them that they are fully informed as to the dire consequence of their actions before you do anything. In fact, find a website that has music in the background and take them to it, and see if they still want to do it.)
That won't help - when you go to a new page it will still have to reload the music, play, etc. Templates are compiled server-side, but if the client requests a new page, it's still a whole new page as far as the browser is concerned.
Any solution for allowing music to play continuously (ie, unbroken) while the user navigates the site is going to be heinous. For example, you could.
1. Use a frameset (yikes!), where one frame is effectively hidden and has the music playing away, the other frame has your content. Then, whenever the user clicks an internal link, the target for the link is that frame. The music frame is never reloaded.
2. Make the entire thing ajaxy (lots of work, hard to do right, requires javascript), so that content is injected into the DOM without changing the page
3. ...no, can't think of anything else. (A POPUP window?? I won't even put it forward as a solution).
Both options kill usability (by making it nigh on impossible for users to bookmark pages) and SEO (can't find dynamic content, plus, pages found by search engines will tend NOT to be in the frame, so those links won't have the music). Additionally, option 1 is just bad programming and option 2 takes a lot of work, knowledge and potentially opens up lots of hairy security issues.
In summary:
- it would be difficult (ie, time consuming = expensive) to do,
- users will hate it,
- it will kill the website as far as search engines go,
- and even if it was easy, you wouldn't be able to sleep at night for the shame of it.
http://www.pixaworks.com/juice/2008/bad-design-music/
There are a lot of bad design elements that a web developer can knowingly or unknowingly include into his or her website template… some due to persistent request from their clients...
It can significantly slow down your website loading time, Most Internet users dislike anything that starts automatically, Most Internet users already have music playing, Even if you’re in the music business, a user would prefer to read about your services and company first before listening to your sample tracks, Your website users may not share your taste in music but they might like your contents... (and so on)
http://www.thesitewizard.com/webdesign/backgroundmusic.shtml
"Before you start, you should be aware that background music that automatically starts playing when a web page is loaded may not be appreciated by a large number of your visitors. Some of them, when greeted with the sudden blaring of music from their speakers, may immediately hit the BACK button of their browsers. This may occur even if you're playing a piece of music that you think is well loved by everyone: remember, there are people who surf the Internet in public libraries, at work, or in the dead of the night when others are asleep. Others may already have their favourite piece of music playing on their computer speakers, and your auto-playing music file will only cause them to be annoyed."
etc.