title: location.reload() doesn't work on remote server
body: <p>I have a javascript animation which uses delay() and setInterval() functions. Everything works fine but animation elements become crazy when user opens another browser tab and goes back to the previous tab.</p>
  
  <p>As a solution I need to reload the page each time a user is visited the animation tab again and it seems the solution is <a href="https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API" rel="nofollow noreferrer">here</a>.</p>
  
  <p>But I see that reloading page works only on localhost. The same code doesn't work on remote server i.e. page is not reloaded by revisiting the page.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>var hidden, visibilityChange; 
  if (typeof document.hidden !== "undefined") {
    hidden = "hidden";
    visibilityChange = "visibilitychange";
  } else if (typeof document.msHidden !== "undefined") {
    hidden = "msHidden";
    visibilityChange = "msvisibilitychange";
  } else if (typeof document.webkitHidden !== "undefined") {
    hidden = "webkitHidden";
    visibilityChange = "webkitvisibilitychange";
  }
  
  function handleVisibilityChange() {
    if (!document[hidden]) {location.reload();}
  };
  
  document.addEventListener(visibilityChange, handleVisibilityChange, false);
  </code></pre>