title: How to get/set current page URL (which works across space-time-browsers-versions)
body: <p>I want to get/set URL of the current page upon certain event.</p>
  
  <p>It seems there are more than one approach for doing it as mentioned in questions/answers below.</p>
  
  <p>Using Jquery</p>
  
  <pre><code>Get URL - $(location).attr('href');
  Set URL - $(location).attr('href',url);
  </code></pre>
  
  <p>Using JavaScript</p>
  
  <pre><code>Get URL - myVar = window.location.href;
  Set URL - window.location.href = "http://stackoverflow.com";
  </code></pre>
  
  <p>Which approach works across space-time-browsers-versions?</p>
  
  <p><a href="https://stackoverflow.com/questions/406192/how-to-get-the-current-url-in-jquery?rq=1">Get current URL in JavaScript?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/503093/how-can-i-make-a-redirect-page-in-jquery-javascript?rq=1">How to redirect to another webpage in JavaScript/jQuery?</a></p>