Skip to content Skip to sidebar Skip to footer

What's The Easiest Way To Parse The Anchor Out Of The Current Page's Location?

I need to the anchor out of a window.location in JavaScript, such as the following url: http://www.example.com/page.html#anchor1 What's the easiest method?

Solution 1:

Solution 2:

This should be exactly what you want:

window.location.hash

Post a Comment for "What's The Easiest Way To Parse The Anchor Out Of The Current Page's Location?"