Dipanshu Mahla
Dipanshu Mahla

Reputation: 152

How to check if someone allowed push notification on a webpage?

I am developing a webpage where the next page depends upon whether the user allowed push notification.

When the user clicks on to allow, it should go to one page and if the user clicks on Not allow then on another.

Upvotes: 0

Views: 783

Answers (1)

You can add a callback function to the notification request as follows:

Notification.requestPermission().then(callback); The callback function gets a result parameter, the value of the result determines if the notifications were allowed, denied or dismissed.

Upvotes: 3

Related Questions