-1

I need help to display website visitor's name (on the popups) by just url?

For example this wordpress website:

https://ngantenstory.id/agus-henny/?u=Jonathan

You can change the name to anything and it will display the exact name on the welcome popups.

No need user database, I assume? No need for the user to register first, etc.

How to do this? Please help.

Thank you.

Codenew
  • 1
  • 1

1 Answers1

0
alert(new URLSearchParams(window.location.search).get("u"))

You can get current page's URL by using window.location,

get it's "search parameter" ("?u=Jonathan"),

and parse it by create an URLSearchParams object,

then get what you want by using get method,

finally use alert or other thing to show it to user.

alert is just for a simple example, don't use it in production, you may want set one of your HTML node's content and style instead.