A
A
Artem Selyansky2019-08-14 18:02:23
Notifications
Artem Selyansky, 2019-08-14 18:02:23

How to check if user is subscribed to browser push notifications?

There is a site that offers to allow the user to send notifications to the browser (push).
Is it possible to somehow check in js whether subscriptions are allowed for a user or not?
To, for example, if the user is not subscribed, display one message on the site, and if subscribed, then another.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2019-08-14
@amlvovich

if ('Notification' in window) {
  // API supported
} else {
  // API not supported
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question