tags:

views:

190

answers:

2

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?

+3  A: 

This should be exactly what you want:

window.location.hash
Daniel Lew
+6  A: 

window.location.hash

Chris Doggett
Dang, didn't know about that!
Darryl Hein