Home > Programming, Servers & Scripts >

Redirect On "Allow" click [push notification] (2)


05-04-2021 01:04 PM #1 sebmac (Member)
Redirect On "Allow" click [push notification]

Im trying to setup a redirect so users are redirected when they click "allow" on push notification

I know some softwares like pushpro have these features built in but i'm just looking for the general javascript code


05-04-2021 02:00 PM #2 jeremie (Moderator)

Code:
Notification.requestPermission().then(function(result) {
  if (result === 'granted') {
    // redirect here
  }
});
More info: https://developer.mozilla.org/en-US/...ifications_API


Home > Programming, Servers & Scripts >