javascript - document.cookie/setCookie not working on Safari and IE -


i trying play music last end point after each page loaded. example not working on safari , ie working fine on firefox,opera , chrome. possible replace jquery cookie plugin , how?

<audio preload="auto" src="a.mp3" loop="true" autobuffer autoplay="true">     unsupported in firefox     </audio>      <script>      function setcookie(c_name,value,exdays)     {         var exdate=new date();         exdate.setdate(exdate.getdate() + exdays);         var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toutcstring());         document.cookie=c_name + "=" + c_value;     }      function getcookie(c_name)     {         var i,x,y,arrcookies=document.cookie.split(";");         (i=0;i<arrcookies.length;i++)         {           x=arrcookies[i].substr(0,arrcookies[i].indexof("="));           y=arrcookies[i].substr(arrcookies[i].indexof("=")+1);           x=x.replace(/^\s+|\s+$/g,"");           if (x==c_name)             {             return unescape(y);             }           }     }      var song = document.getelementsbytagname('audio')[0];     var played = false;     var tillplayed = getcookie('timeplayed');     function update()     {         if(!played){             if(tillplayed){             song.currenttime = tillplayed;             song.play();             played = true;             }             else {                     song.play();                     played = true;             }         }          else {         setcookie('timeplayed', song.currenttime);         }     }     setinterval(update,1000);     </script> 


Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -