title: How do I make the browser back button trigger an input's change event?
body: <p>I'm trying to detect changes to input fields to warn users of unsaved changes on a form. I'm using the onchange event on fields to record that the form changed. I'm then using the beforeunload window event to stop the user from leaving the page if a save is needed. The problem is that the back button on all major browsers does let the active input fire the change event. How do I get around this problem? </p>
  
  <p>Below are the test files I'm using. I want the alert to fire when the user edits the input field and then immediately clicks back. Editing the text and then clicking on the body will trigger change but that along is not enough.</p>
  
  <p><strong>starteditor.html</strong></p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;a href="editor.html"&gt;Click me&lt;/a&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>editor.html</strong></p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"&gt;&lt;/script&gt; 
      &lt;script&gt;
          $(document).ready(function(){
              $("form").delegate("input", "change", function () { alert("I changed") });
          });
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      Edit text then click the browsers back button.
      &lt;form&gt;
          &lt;input type="text" /&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>