ServiceWorker: scriptURL 屬性
注意:此功能在 Web Workers 中可用。
返回作為 ServiceWorkerRegistration 的一部分定義的 ServiceWorker 序列化指令碼 URL。必須與註冊 ServiceWorker 的文件同源。
值
字串。
示例
js
const sw = navigator.serviceWorker.controller;
console.log(sw.scriptURL);
// https://example.com/scripts/service-worker.js
規範
| 規範 |
|---|
| Service Workers # service-worker-url |
瀏覽器相容性
載入中…