Get a Hash Value From Current Page URL In JavaScript

To get the current page URL, Use below code:

  1. var currentURL = window.location;   

If you want to get hash value from current page URL, we just need to add .hash in the above javascript statement like:

  1. var currentHashURL = window.location.hash;