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

231
Views
Listening to "notificationclick" in browsing context

I have set up desktop notifications using:

Notification.requestPermission((result) => {
  if (result === "granted") {
    navigator.serviceWorker.register("/dummy.js").then((registration) => {
      registration.showNotification("Hello", {
        body: "Buzz! Buzz!",
        actions: [{...}],
      });
    });
  }
});

I can't use the Notification constructor, as I need to show buttons (actions) on the notifications, and for some reason the constructor doesn't support this.

I have no intention of firing or listening to the these notifications when the app is not open in a browser tab.

Is there a way to listen to the "notificationclick" and other notification related events from the main browsing context, and not from within the worker?

Alternatively is there any way to use the full set of features on the Notification constructor without having a worker?

To clarify further: I don't need the worker for anything other than using actions on the notifications. I only need to fire notifications / listen to notifications while the app is running in the browser, so I want to interact with the worker as little as possible. Writing logic for notification events in the worker itself is highly undesirable.

about 4 years ago · Santiago Trujillo
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!