Get URL without the hash

/ Published in: JavaScript
Save to your folder(s)

Copy this code and paste it in your HTML
  1. var url = window.location.href;
  2. var hash = window.location.hash;
  3. var index_of_hash = url.indexOf(hash) || url.length;
  4. var hashless_url = url.substr(0, index_of_hash);

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.