title: How to make onclick event to work only once
body: <p>what I want to do is when someone click anywhere in the page.
  A new window will open, but I want this to happen only once, so when someone click again on body, the function should not run.
  Any advice? No jquery please.</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;body onclick=&quot;myFunction()&quot;&gt;
  &lt;script&gt;
      function myFunction() {
          window.open(&quot;http://www.w3schools.com&quot;);
      }
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>