Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the easiest way to parse the anchor out of the current page's location?

Tags:

javascript

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?

like image 700
Darryl Hein Avatar asked Dec 08 '22 07:12

Darryl Hein


1 Answers

window.location.hash

like image 150
Chris Doggett Avatar answered May 19 '23 16:05

Chris Doggett