0

i am using the following code in home page for background music

<object type="application/x-shockwave-flash" data="/Music/dewplayer-mini.swf" align="right"    width="100" height="20" id="dewplayer" name="dewplayer">
<param name="movie" value="/Music/dewplayer-mini.swf" />
<param name="flashvars" value="mp3=/Music/demo.mp3&amp;autostart=1&amp;autoreplay=1" />
<param name="wmode" value="transparent" />
</object>

currently music will be played in home page. i dont want the music to be played when i revisit the home page from subpages.

can I use cookie or session ? any help thanks ?

charan kumar
  • 2,119
  • 2
  • 20
  • 26

2 Answers2

1
<html>
    <head>
        <link rel="stylesheet" type="text/css" href="app.ui.css" />
        <script src="http://code.jquery.com/jquery.min.js"></script>
        <script src="https://raw.githubusercontent.com/carhartl/jquery-cookie/master/src/jquery.cookie.js"></script>
        <script>
            $(function(){
                if($.cookie('firstVisit')==undefined){
                    $.cookie('firstVisit','true');
                }else{
                    $.cookie('firstVisit','false')
                }
                var firstVisit = $.cookie('firstVisit');
                if(firstVisit=='true'){
                    $('#welComeVideo').show();
                }else{
                    $('#welComeVideo').hide(); 
                }
            })
        </script>
    </head>
    </body>

    <div id="welComeVideo" style="display:none;">
        <object type="application/x-shockwave-flash" data="/Music/dewplayer-mini.swf" align="right"    width="100" height="20" id="dewplayer" name="dewplayer">
            <param name="movie" value="/Music/dewplayer-mini.swf" />
            <param name="flashvars" value="mp3=/Music/demo.mp3&amp;autostart=1&amp;autoreplay=1" />
            <param name="wmode" value="transparent" />
        </object>
    </div>
    </body>
</html>

Please try this

Rohit Batham
  • 1,238
  • 1
  • 9
  • 13
-1

You can use a session cookie

then play music using javascript only when the cookie is not present/set

How to Play a Flash Movie with JavaScript in Firefox

Community
  • 1
  • 1
Aman B
  • 2,276
  • 1
  • 18
  • 26