title: Set button link behind a java script function
body: <p>I want to set up the call to action link behind a java script function. But somehow it doesnt work and i cant find the problem.    </p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  
  &lt;a href="javascript:void(0)" rel="noreferrer" onclick="exit_offer();PreventExitPop = false" class="claim"&gt;click here&lt;/a&gt;
  
  &lt;script type="text/javascript"&gt;
       function exit_offer() {
              window.onbeforeunload=null;
            window.location = “http://example.com”;
         }
  &lt;/script&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>