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.
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.
You can get
waiting.scriptURL
oractive.scriptURL
, pass result toURL()
constructor, get.search
property of objectI'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:
In either of those cases, once you have a
URL
object, you can use itssearchParams
property if you're interested in the query parameters: