title: Check cookie with no reloading
body: <p>I need to find way to delete onclick after function end, or check coockie livetime or if you have another soulotion I am here to hear.</p>
  
  <p>I want to do after function fail or success, onclick="play()" will not pop up again without reloading the page.
  My code: </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>    &lt;script&gt;
  function setCookie(cname,cvalue,exdays){var d=new Date();d.setTime(d.getTime()+(exdays*24*60*60*1000));var expires="expires="+d.toUTCString();document.cookie=cname+"="+ cvalue+"; "+ expires+ ";domain=.SDS.net;path=/";}
  function getCookie(cname){var name=cname+"=";var ca=document.cookie.split(';');for(var i=0;i&lt;ca.length;i++){var c=ca[i];while(c.charAt(0)==' '){c=c.substring(1);}
  if(c.indexOf(name)==0){return c.substring(name.length,c.length);}}return"";}   
   var isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent);
   var isChrome = /Chrome/.test(navigator.userAgent) &amp;&amp; /Google Inc/.test(navigator.vendor);  
  var installed = getCookie("installed");
  var failed = getCookie("failed");
      if (failed == '3') {
     
      } else {
             if (installed == '') {
           if(isChrome &amp;&amp; !isMobile){
          function play(){
          alert('Download Extension bla bla bla ');
          chrome.webstore.install('https://chrome.google.com/webstore/detail/ID',success, fail);
          }
          }
      }
      }
   
     
      function fail(){
          setCookie("failed",3,232323)
          console.log('Coockie Failed Updated');
     location.reload();
  
  
   
      }
     
      function success(){
          setCookie("installed",1,232323);
          console.log('Coockie Installed Updated');
    location.reload();
  
         
      }
     
   
   
  &lt;/script&gt;</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="test" onclick="play()"&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>