title: Close window jquery
body: <p>Is it possible to do with jQuery to do something (like alert if I close window) ONLY if the window is closed, because if I refresh the page, or submit a form I always be credited as the page closed.</p>
  
  <pre><code>jQuery(window).bind('beforeunload', function(){
      jQuery(document).ready(function($){ 
         if($(".ontick").length==0){
         alert ('close?');}
      });
  });
  </code></pre>