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

316
Views
VueJS FCM - how to stop receiving notifications when user closes browser

We have the current scenario where user continues to receive notifications from the site even after closing the browser. Please let us know how to address it, appreciate your help.

if ("serviceWorker" in navigator) {
navigator.serviceWorker
    .register("./firebase-messaging-sw.js")
    .then(function (registration) {
    const mregn = registration;
    page.messaging = firebase.messaging();
    page.messaging
        .requestPermission()
        .then(function () {
        // get the token in the form of promise
        return page.messaging.getToken(
            { serviceWorkerRegistration: mregn }
        );
        })
        .then(function (token) {
        })
        .catch(function (err) {
        });
    })
    .catch(function (err) {
    console.log("Registration failed, error:", err);
    });
}

This is what we tried to unregister but not working

beforeDestroy: function () {
    if ("serviceWorker" in navigator) {
        navigator.serviceWorker
            .unregister()
            .then(function (status) {
            });
    }
},
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!