title: How can I get the url of the previous page when triggering the popstate event?
body: <p>Here's a simple example of <code>pushState</code> and <code>popstate</code> event:</p>
  
  <pre><code>&lt;button id="example_btn"&gt;Click me&lt;/button&gt;
  
  &lt;script&gt;
  $("#example_btn").click(function(){
              history.pushState( 
                  {
                      'url' : "example.htm"
                  }, null, "example.htm");
  });
  $(window).bind('popstate', function (event) {
      if (event.originalEvent.state) {
          console.log(event.originalEvent.state.url);
      }
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>When triggering the <code>popstate</code> event, it shows the url of the current page.</p>
  
  <p>My question is:</p>
  
  <p>How can I get the url of the <strong>previous</strong> page when triggering the <code>popstate</code> event in this case?<br /><br /><br />P.S. I have tried <code>document.referrer</code> but it didn't show anything.</p>