Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get the full url including hash with content in JavaScript

How can I get url with content after hash ?

window.location return me url without hash :/

for example:

www.mystore.com#prodid=1

window.location return only www.mystore.com

like image 558
gruber Avatar asked Jul 21 '11 15:07

gruber


3 Answers

window.location.hash

https://developer.mozilla.org/docs/Web/API/Window/location

Note the properties section.

like image 180
Brad Christie Avatar answered Oct 04 '22 21:10

Brad Christie


Try window.location.hash this will work

like image 10
ShankarSangoli Avatar answered Oct 04 '22 21:10

ShankarSangoli


this returns just content after hash

window.location.hash.substr(1);

ex: www.mystore.com#prodid=1

this will give us : prodid=1

like image 3
Tarik FAMIL Avatar answered Oct 04 '22 22:10

Tarik FAMIL