Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

118
Views
Service worker not in navigator

I am trying to get a service worker to be able to subscribe for notifications as well as send push notifications. To do this I am registering a service worker (one shows in the Chrome console) and then trying to do my task there. So far I can register a service worker but it will not show in the navigator like a bunch of guides said it should. Below is my current code stripped down to a minimum test case. I am doing this in Vue.js as my front end framework.

Register

import { register } from 'register-service-worker'
  console.log('Registering service worker')
  register(`service-worker.js`, {scope: '/'},{
    ready () {
      console.log('Service worker is ready.')
    },
    registered () {
      console.log('Service worker has been registered.')
    },
    error (error) {
      console.error('Error during service worker registration:', error)
    }
  })

serviceworker file

console.log(navigator) // This is where I am manually checking for serviceWorker to exist

if ('serviceWorker' in navigator) {
    navigator.serviceWorker.ready.then(function(serviceWorkerRegistration) {
        console.log("SW Registered pre push manager")
    })
}

I have researched google and SO and all that points to is that I need https except on localhost (which I am on) and that I need to make sure the scope is correct, both are good there.

My question is how can I get this to work where the code inside my if statement will run

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!