javascript get parameters from URL

javascript gets parameters from the URL: such as getting the username query parameter in the url:
var url = new URL(window.location);

var username = url.searchParams.get(‘username’);

refer to:

The post javascript to get parameters from URL first appeared on Lenix Blog .

This article is reprinted from https://blog.p2hp.com/archives/9701
This site is for inclusion only, and the copyright belongs to the original author.