DOM Exception permission denied - periodic bckground sync

Viewed 745

I have registered the JS file for the service worker by using React JS. But, when I am trying to register the periodic-background-sync I am getting an error. Do I need to do any settings in google chrome?

The status.state flag is always retuning denied. I am not able to perform the background periodic sync.

Please see the below code

const status = await navigator.permissions.query({
    name: 'periodic-background-sync',
});

After checking the status, it is always returning "DENINED".

1 Answers

You need to install the PWA app first only after that chrome will grant you permission to use "periodic-background-sync".

Check out their Demo App.

After installing the APP try check the status

navigator.permissions.query({ name: "periodic-background-sync" }).then((status)=>{ console.log(status)})

Related