0

I am trying to save a javascript variable that is text inside the URL of the page I am editing.

The URL looks like this:

file... ...?=&username=Sarah_Wesley

I can't just copy it and save it because the text after '=&username=' will be different for different users and I would like to get this text out.

I'm also open to any other suggestions you have for extracting the username that are less messy than this one.

Thanks!

1 Answers1

0

Use window.location.search object. You'll get all the info within it.

Indranil Mondal
  • 2,799
  • 3
  • 25
  • 40