Background music not working??

S

sally jo

Here's the code I'm using:

<script language="Javascript">
if (navigator.userAgent.indexOf('MSIE') > -1)
{
document.write('<bgsound src="Norah Jones - Sunrise.mp3"
loop="1">');
} else {
document.write('<embed src="Norah Jones - Sunrise.mp3"
autostart=TRUE hidden=true loop="1">');
}
</script>

and here's the site:

http://cc.usu.edu/~cassia/index.html

Am I supposed to add that code to all the pages on the site?
 
T

Travis Newbury

sally said:
Here's the code I'm using:
Am I supposed to add that code to all the pages on the site?

I will be the first to say it.....

You are not supposed to add that code to any page on the site.....
 
B

Beauregard T. Shagnasty

sally said:
Here's the code I'm using:

<script language="Javascript">
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
That's a good thing; means it won't play in my browser. Also, it is an
incorrect syntax.
if (navigator.userAgent.indexOf('MSIE') > -1)
{
document.write('<bgsound src="Norah Jones - Sunrise.mp3"
loop="1">');
} else {
document.write('<embed src="Norah Jones - Sunrise.mp3"
autostart=TRUE hidden=true loop="1">');
^^^^^^^^^^^^^^^^

What if I was already playing a nice mellow jazz CD, and Norah came
blaring out of my speakers on top of my jazz? I would immediately hit
the back button. Or what if my grandbaby was having a nap and you woke
her up?

Further,
<http://cc.usu.edu/~cassia/Norah Jones - Sunrise.mp3>

ERROR 404 - The requested resource could not be found.

File not found ... NO:[REVERSE.MAPPING.FOR.THIS]FILE.PATH
(document, bookmark, or reference requires revision)

Additional information: 1xx, 2xx, 3xx, 4xx, 5xx, Help

WASD/8.0.0h Server at barney.usu.edu Port 80

Maybe your server doesn't like spaces in the file names?
}
</script>

and here's the site:

http://cc.usu.edu/~cassia/index.html

Am I supposed to add that code to all the pages on the site?

Remove it from all pages.

Have a read of this site and write valid code:
http://htmldog.com/
 
H

Harlan Messinger

sally said:
Here's the code I'm using:

<script language="Javascript">
if (navigator.userAgent.indexOf('MSIE') > -1)
{
document.write('<bgsound src="Norah Jones - Sunrise.mp3"
loop="1">');
} else {
document.write('<embed src="Norah Jones - Sunrise.mp3"
autostart=TRUE hidden=true loop="1">');
}
</script>

If it isn't IE, you use a non-existent BGSOUND tag and expect it to work?
and here's the site:

http://cc.usu.edu/~cassia/index.html

Am I supposed to add that code to all the pages on the site?

Whatever does work, of course you have to have it on each page. When you
leave a page, you leave the whole page, audio included.

But if you include it on each page, it'll start from scratch each time
the user goes to a new page.

The real answer is: it annoys users greatly to have sound unexpectedly
coming out of their browsers. How do you know they're not in a cubicle
at the office, or at a meeting, or in a library? Or maybe they're
already listening to music, or watching TV or a movie. How do you think
they'll react to your decision that they should listen to your music
instead?

If you have a neat tune you think they *might* like to listen to, give
them link to click, so they can listen to it in their music player
instead of having it play in the browser.
 
C

cassia

Harlan said:
If it isn't IE, you use a non-existent BGSOUND tag and expect it to work?

I uploaded it again, it seems it didn't load correctly, but would that
code work? HTMLdog.com doesn't appear to have the code for adding
background music...This is for a class, and I just need to have an
"enhancement" so I thought I'd throw in music.

Whatever does work, of course you have to have it on each page. When you
leave a page, you leave the whole page, audio included.

But if you include it on each page, it'll start from scratch each time
the user goes to a new page.

The real answer is: it annoys users greatly to have sound unexpectedly
coming out of their browsers. How do you know they're not in a cubicle
at the office, or at a meeting, or in a library? Or maybe they're
already listening to music, or watching TV or a movie. How do you think
they'll react to your decision that they should listen to your music
instead?


I definitely agree...but like I said, it's just for a class. And I'm
not really sure what an "enhancement" entails....? Unless you've got
any ideas??

If you have a neat tune you think they *might* like to listen to, give
them link to click, so they can listen to it in their music player
instead of having it play in the browser.

Great idea, so is the code that they would click to link the same as if
I were linking to another image or page?
 
D

dorayme

Harlan Messinger said:
If you have a neat tune you think they *might* like to listen to, give
them link to click, so they can listen to it in their music player
instead of having it play in the browser.

No need to go quite that far, nearer is to give them a choice
though.
 
C

cwdjrxyz

sally said:
Here's the code I'm using:

<script language="Javascript">
if (navigator.userAgent.indexOf('MSIE') > -1)
{
document.write('<bgsound src="Norah Jones - Sunrise.mp3"
loop="1">');
} else {
document.write('<embed src="Norah Jones - Sunrise.mp3"
autostart=TRUE hidden=true loop="1">');
}
</script>

and here's the site:

http://cc.usu.edu/~cassia/index.html

Am I supposed to add that code to all the pages on the site?

That script comes from the very early browser war era and will fail on
many modern browsers for several reasons that I will not bore you with.

I suggest using an m3u play list. For an example, see
http://www.cwdjr.net/mpg/NGdemo.html . This is your main page on which
you want some sound. I include only sound on this page to make it
simple. The code for this page with the url above is:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>NGDemo.html</title>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
</head>
<body>
<p><a href="http://www.cwdjr.net/mpg/playlist1.m3u">Play Music</a></p>
</body>
</html>

The important part is the paragraph with the link to the playlist,
which you would use on every page for which you want sound.

Since the above page calls a playlist, we need one. The address, which
is the url for the playlist page, is:
http://www.cwdjr.net/mpg/playlist1.m3u . The code for the playlist page
with this url is just a list of urls of one or more songs you have
stored somewhere on your site. They can be in a mixture of mp3, wav,
and several other formats, depending on the players you have on your
computer. The code I used on this playlist page is:


http://www.cwdjr.net/mpg/MackieMesser.mp3
http://www.cwdjr.net/largesou/cat3.wav

Since several different players will play a m3u playlist, I don't know
which player will come up for you. You can configure players to make
one primary for m3u playlists, if you want to, or just take what you
get. I use Winamp for m3u playlists. The demo I give above works for me
on current versions of IE6, Opera, and the Mozilla
family(Firefox,Netscape, Mozilla, Seamonkey).
 
S

sally jo

cwdjrxyz said:
That script comes from the very early browser war era and will fail on
many modern browsers for several reasons that I will not bore you with.

I suggest using an m3u play list. For an example, see
http://www.cwdjr.net/mpg/NGdemo.html . This is your main page on which
you want some sound. I include only sound on this page to make it
simple. The code for this page with the url above is:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>NGDemo.html</title>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
</head>
<body>
<p><a href="http://www.cwdjr.net/mpg/playlist1.m3u">Play Music</a></p>
</body>
</html>

The important part is the paragraph with the link to the playlist,
which you would use on every page for which you want sound.

Since the above page calls a playlist, we need one. The address, which
is the url for the playlist page, is:
http://www.cwdjr.net/mpg/playlist1.m3u . The code for the playlist page
with this url is just a list of urls of one or more songs you have
stored somewhere on your site. They can be in a mixture of mp3, wav,
and several other formats, depending on the players you have on your
computer. The code I used on this playlist page is:


http://www.cwdjr.net/mpg/MackieMesser.mp3
http://www.cwdjr.net/largesou/cat3.wav

Since several different players will play a m3u playlist, I don't know
which player will come up for you. You can configure players to make
one primary for m3u playlists, if you want to, or just take what you
get. I use Winamp for m3u playlists. The demo I give above works for me
on current versions of IE6, Opera, and the Mozilla
family(Firefox,Netscape, Mozilla, Seamonkey).


Thank you so much , that was very helpful!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top