Link to home
Start Free TrialLog in
Avatar of Refael
RefaelFlag for United States of America

asked on

Get URL hash text

Check if the URL has a hash
If it does then grab the text after the hash

e.g.  http://someurl.com/books#bookname

I know how to check if the URL has a hash but I don't know how to work with the "split" function to get the text after the "#".

Thanks!

if (window.location.href.indexOf('#') > -1) { }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Snarf0001
Snarf0001
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Refael

ASKER

Thank you Snarf0001 :-)