summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/service-workers/service-worker/resources/install-worker.html
blob: ed20cd4dca6a14e427b907a1d5147c88596bb1f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!DOCTYPE html>
<html>
<body>
<p>Loading...</p>
<script>
async function install() {
  let script;
  for (const q of location.search.slice(1).split('&')) {
    if (q.split('=')[0] === 'script') {
      script = q.split('=')[1];
    }
  }
  const scope = location.href;
  const reg = await navigator.serviceWorker.register(script, {scope});
  await navigator.serviceWorker.ready;
  location.reload();
}

install();
</script>
</body>
</html>