title: Prevent user pressing f5 button in pop up window
body: <p>I want to prevent users from pressing the F5 button because of running exam test in my project.</p>
  
  <p>If I use a normal browser window, my code works fine, but now I want to use it in a popup windows - in the popup windows my code is not working. My code is:</p>
  
  <pre><code>document.onkeydown=function(e) {
      var event = window.event || e;
      if (event.keyCode == 116) {
          event.keyCode = 0;
          alert("This action is not allowed");
          return false;
      }
  }
  </code></pre>