title: save changes before exit on remote server
body: <pre><code>var save;
  
  $('textarea').on('input', function(){
      save = 1;
  });
  
  $(window).on('beforeunload', function(){
      if(save == 1){// ajax code to save changes;}
  });
  </code></pre>
  
  <p>So if I type something inside a textarea and close the browser's tab - the changes are saved if I'm on localhost (xamp, chrome).  </p>
  
  <p>The same code on remote server doesn't work - changes are not saved.</p>
  
  <p>Any help?</p>