title: Use JQuery or onbeforeunload for IE and FF
body: <p>I'm working in a Flex4 application, using javascript, in the "index.template.html" document. I'm having an issue being able to use onbeforeunload with Firefox. The application works perfectly in IE, but the exact same one doesn't sit well with FF. (See below)</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  window.onbeforeunload=before;
  window.onunload=after;
  
  function before(evt)
  {
     var flex=document.$(application)||window.$(application);
     flex.unloadMethod(); //custom method to log out the user
  }
  
  function after(evt)
  {
  
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>From what I've found, FF doesn't seem to register onbeforeunload events, so I found that the popular thing to use instead is binding with JQuery. So, I deleted the above code and replaced it with the below code, but it doesn't display a pop-up when the user tries leaving the page in both IE and FF. Anyone that seems to be using JQuery for this seems to be doing the exact same thing, so I don't know what's going on.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  $(window).bind("beforeunload",function(event){
     return "This should create a pop-up";
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>Eventually it would be nice to call the "flex.unloadMethod" like in the first bit of code, but for the time being I'm just trying to get a pop-up to work so I know I'm on the right track. Any insight would be greatly appreciated.</p>