DEV Community

loading...

Can I directly set browser notification to allow?

shubham2270 profile image Shubham Kumar ・1 min read

Is it possible to directly set the notification to allow instead of using Notification.requestPermission() which prompts the user to Allow or block?

Discussion

pic
Editor guide
Collapse
brandinchiu profile image
Brandin Chiu

No, and we should all be glad that we can't. It would be an absolute adware nightmare if sites could just bury themselves directly into desktop notifications.

This is why alert() is blocked by browsers in most cases now

Collapse
lokidev profile image
LokiDev

Nope. And that's exactly how it should be.