<script src=sw.js></script> will not register the script as a Service Worker (running in a background thread).
You need to navigator.serviceWorker.register('/path/to/your/worker.js') for that.
I used <link rel="worker" href="sw.js"> because it allows me to give a relative URL, but get an absolute URL when accessing the href attribute.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
<script src=sw.js></script>
will not register the script as a Service Worker (running in a background thread).You need to
navigator.serviceWorker.register('/path/to/your/worker.js')
for that.I used
<link rel="worker" href="sw.js">
because it allows me to give a relative URL, but get an absolute URL when accessing the hrefattribute
.