Waqas Abbasi
Waqas Abbasi

Reputation: 21

Trying to Permission Request for notifications Error Javascript

I'm trying to use Pushjs.org for quick fast notification system but for some reason Chrome keeps telling me that while using Push.Permission.request();

Permission for the Notification API may no longer be requested from a cross-origin iframe. You should consider requesting permission from a top-level frame or opening a new window instead

I'm not sure what this meant so I used the regular notification request using

Notification.requestPermission()

But it also returned the same thing. I tried doing some research and was unable to figure how what the right way of asking user for permission would be.

Upvotes: 2

Views: 1617

Answers (1)

Joel García
Joel García

Reputation: 191

In newer versions of Chrome you cannot request the Notification API, unless the site is httpssecured and also you cannot request it from a cross-origin iframe.

If you do meet this requirements, you should be able to use notifications and background push notifications on Chrome.

Upvotes: 1

Related Questions