javascript - # variables in URL address in js -


How do I obtain a variable from a URL address? I am using this code but it is not working:

  var x = window.location; Var y = x.indexOf ('#', 0); X = x.substring (y, x.length);   

Getting the following error:

  Error: x.indexOf function is not    

What you do not want is the window. Location but window.location.href

However, I will use the window. Location

Comments