-3

Is there a way, when a page loads or at some point in time, to detect if there are parameters in the URL?

I'm working on a project where I send to and get messages from a server, but in doing so there are uri's which have information in them.

https:/www.example.com/?code=123&name=me

and i would like to know when I get them.

Telo Springs
  • 45
  • 1
  • 12

2 Answers2

0

You're looking for the location.search property, which returns the full value of the querystring.

You'll need to parse it yourself.

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
0

You may check if the url contains "?", if (url.contains('?')) {} else {}

imnancysun
  • 612
  • 8
  • 14