get hash from url code example Example 1: get hash from url window.location.hash = '#hash_value'; Example 2: get hash js location.hash