MDN self-hosted library · e01.org

ServiceWorker: scriptURL property

Service Workers API

Open notebook · 1 cells web-api-instance-property upstream source

Service Workers API

The scriptURL read-only property of the ServiceWorker interface returns the ServiceWorker serialized script URL defined as part of ServiceWorkerRegistration. Must be on the same origin as the document that registers the ServiceWorker.

Value

A string.

Examples

const sw = navigator.serviceWorker.controller;
console.log(sw.scriptURL);
// https://example.com/scripts/service-worker.js

Specifications

Browser compatibility