It sounds like this task would be best done with PHP. First, you will need to make sure the server with your website has PHP. Upload a file called phpinfo.php with the following code:
Point your browser to this file. If your server has PHP, your browser will display a big table of information. At the top, it will give you the PHP version. The following information is for PHP 4.1 or later.
Now, the next thing to do is to make sure that your home page has the proper extension. Rename the file so that, instead of ending with .html or .htm or the like, it ends with .php.
Now you have two options. You can either set this up with a cookie or with a PHP session. Cookies are easier to implement, but some people set their computers to not allow cookies, so using a PHP session is a better method. In this post I will explain how to use cookies to do what you want. In the future, if I have time, I will write another post describing how to do the task with a PHP session.
Cookies:
Insert the following code at the top of your home page. It must be at the very, very top, above even an empty line or a space in the code.
Code:
<?php setcookie("firsttime","no") ?>
Then, in the body of your document, where you want the music file to go in, put the following code:
Code:
<?php
$firsttime = $_COOKIE[firsttime];
if (@$firsttime != "no") { echo "<embed src='yourmp3.mp3' />"; }
?>
You can, of course, mess with the embed tag to change the style of how the music player is displayed. For example, putting style='width:0;height:0' in the embed tag will effectively hide your audio player, but the audio will still play after it loads. Just be sure that any quotes you put within the echo statement are either single quotes (') or escaped (\").
When the user closes their browser, the cookie is removed, so when the browser is reopened, the music file is played again. But just navigating to a new page doesn't remove the cookie, so when the home page is reaccessed, the browser will see the cookie and not play the music.
I hope this helps.
Marion Sudvarg