title: How to get the selector for window.location.href using jQuery 1.4.4
body: <p>We have a js function that redirects the user to a new page from a dropdown using Struts2.  Here is the code.</p>
  
  <p>The Struts2 dropdown that starts everything:</p>
  
  <pre><code>&lt;s:select name="selectName" list="List" listKey="nameCode" headerKey='-1'
  listValue="description" headerValue="Please select..."  value="namedValue" onchange="redirectNextPage(this.value)" /&gt;
  </code></pre>
  
  <p>Here is the redirect function that fires next:</p>
  
  <pre><code>function redirectNextPage(id){
     var page = "&lt;s:url action='&lt;path&gt;.action'/&gt;?&lt;param&gt;="; 
     window.location.href=(page + id); 
  
   }
  </code></pre>
  
  <p>I need to use a selector to capture window.location.href and bind it to my UnBindWindow function.</p>
  
  <pre><code>//Bind Links we dont want to affect
  $('a[href^="http://"]').bind('focus', UnBindWindow); //Code not working?
  
  //UnBind Function
      function UnBindWindow(){
          $(window).unbind('beforeunload', ReturnMessage);
      }
  ...
  </code></pre>
  
  <p>I incorrectly assumed that focus would be the proper DOM event type I needed.  What happens is the select goes to the javascript function and then the onbeforeunload event fires without my jQuery code getting called.</p>
  
  <p>How do I properly bind an event to the window.location.href so I can prevent a beforeunload dialog from firing off the select dropdown, but still work for other elements on the jsp page?  </p>