// www.example.com/users?token=12345 let params = (new URL(document.location)).searchParams; let token = params.get("token"); // 12345
Object.fromEntries(location.search.substr(1).split("&").map(pair => pair.split("=")))