Continuous Music

Does anyone know how I could paly continuous background music as someone navigates around a website? This is wthout the music restarting when a page is reloaded and preferably without interuption.

I want to avoid non accessible methods like I-frames and yes, I know some are going to say it’s not friendly to force music on a viewer but just bear with me on that point and consider it an acedemic issue.

If you want to avoid popup windows and iframes, I think the only other solution (bar Flash) is to use AJAX. This would mean the music-playing stuff stays static on the page and the page contents are changed via AJAX. Naturally this means the use of JavaScript and a lot of extra work, which are pretty non-negligible shortcomings! I suppose it would be OK if the “basic” version of the page was a static HTML page without the music, while the enhanced version used AJAX to load the changing content.

That is a paradoxical statement, having music playing in the background without the visitors permission is by definition making the page inaccessible, it inteferes with screen readers for the visually impaired so they cannot hear speech over the noise (loosing the ability to “see” the website), it can perpetuate the condition of someone with tinnitus or an auditory impairment (ones that don’t limit hearing but intefere or give sensitivity) and for those with cognitive impairments (who have poor concentration like ADHD or have impairments which affect focus) it can seriously disturb or force them to dislodge their train of thought or ability to concentrate.

So if you are looking for an accessible way to achieve this, your unfortunately digging yourself a hole :slight_smile:

Alex, those are all trivial reasons not to have music on the site. The real, over-riding reason that even the hypothetical discussion of music on the web site is evil is … I already have Muddy Waters and Howlin’ Wolf playing, and damned if I want somebody else’s idea of good music to butt in. :frowning:



There is also a severe accessibility situation which can arise when one throws their machine out the nearest window. :stuck_out_tongue:

In all seriousness, barleytwist – what is this for?

While it’s a good point (and I hate it when that happens too), I wouldn’t consider any accessibility reason trivial, while you can pause or get over the music blasting pretty effortlessly (even if your angry) a disabled person could suffer distress, inability to resolve the problem or actually suffer symptoms related to the noise pollution which is far more serious :slight_smile:

Correction: It’s a usability situation, it’s only an accessibility issue if you attempt to jump out the window after it :lol:

I think barleytwist made the point in the original post that he’s aware of how irritating autoplaying music is on websites. He asked to be beared with, as it could well be for some academic, humour or game-like purpose, where (hopefully) the user is aware of what is going to happen before the music starts playing.

Alex, it’s called being facetious; tongue in cheek.



If your navigation is not too complex and you don’t have a complicated CMS backend, then it would be fairly straightforward to use a simple tabber script to control your navigation, and display each “page” as a separate tab. This way users don’t actually need to change pages. If you have the tabber load up each tab from a separate HTML file, then the search engines will follow that just like a regular link. If you load each tab from content stored on the page, then the search engines can simply index that one page for all of the content, but they might not like that they can’t link directly to the content since they probably won’t be able to link directly to the tab in question (even if it is possible, the search engine probably won’t figure out how).

The only thing it will screw up for the majority of your actual site visitorsis the ability to grab the URL for a specific page from the address bar … and the constant, annoying music.

Although like Alex mentioned, your original question is kinda paradoxical since this isn’t possible to do in an “accessible” way.

I had to create something similar for a WordPress theme a while ago. It was a total nightmare to setup as I couldn’t use a basic tabber script to do it and actually had to load each new page the old fashioned way via iframes.

FYI, the tabber script idea would work fine with screen readers.

I forgot to also mention that this is essentially what Raffles suggested earlier. I’m just pointing out that a standard tabber script takes care of all of the complicated javascript that would go along with it and makes sure it is all done in an as “accessible way” as possible. Or at least as accessible as it can be where javascript/Ajax comes into it.

I would suggest against it.

A nice alternative would be to use ajax to post newer pages to a frame and keep the bg audio in the main page.

Google ajax tabs.

Why would you prefer to use ajax to load a page in a frame? I’ve always figured the regular method of loading pages into the existing page via ajax was a better idea.

That loads it into a hidden frame. I’ve not seen anything but that.

See where it says “Demo #3- All contents fetched via “IFRAME””

If there is another method maybe thats better.

Yeah, you can just load the content into the existing page via ajax. Something like this would do it …

You could add the navigation in via javascript, then have a non-javascript menu sitting below it which links to slight different URLs which can load separate pages. This would make it work fine without javascript (in which case the music probably isn’t playing anyway) and it would give search engines something better to navigate via.

There also might be ways to open up tabber scripts onto a certain tab, perhaps via a #link? Although I’m not sure about that. It’s not something I’ve tried doing before.

O sweet! Thought they where all frames. Yeah thats nice.

I have the Professional Ajax book from a few years back and they where using frames.

I like yours better however.

There is a really simple solution to what the OP wants to do so that the music will play continuously AND where it first asks the visitor’s permission before it starts.

<a href=“music-filename-goes-here”>Play Music</a>

And the music opens in a media player. ok. Sounds realistic to me

This is the greatest solution which also avoids confusion: users may not detect the source of the playing music, especially if they have a couple of tabs open in their browser.

If music really adds to the user experience in your case, you might still load a track when page loads and offer the link for continuous playback.

Yea, people always over analyze everything and the best solution is often the most basic and overlooked. :slight_smile:

++ both the music and the sentiment.

More than a few times I have opened someone’s link, only to hear the strange combination of whatever my Amarok’s playing and the crap the new site is playing.