Get page URL parameters from a service worker
问题 How do I get page URL with parameters from a service worker? I have tried self.registration.scope but that doesn't include the parameters. 回答1: I'm not clear as to whether you're asking about getting the service worker script's URL, or the URLs of all of the client pages that are open under the service worker's scope. So... here's how to do both: // Get a URL object for the service worker script's location. const swScriptUrl = new URL(self.location); // Get URL objects for each client's