News for hackers. Stuff that matters.
Re:Ask HN: Are browser notifications user-hostile? by pubb on Tuesday December 19, 2017 @01:03AM (#15958118)
Notifications can be useful for web apps. A good rule of thumb is to only ask for permission when the user interacts with your app. For example, I ask for permission when the user clicks a button with the text "Enable Push Notifications" on the user settings screen. Then I let the user choose what kind of notifications they'd like to receive - typically CRUD actions for entities that the user cares about.
Re:Ask HN: Are browser notifications user-hostile? by JoshTriplett on Tuesday December 19, 2017 @01:20AM (#15958162)
> A good rule of thumb is to only ask for permission when the user interacts with your app. For example, I ask for permission when the user clicks a button with the text "Enable Push Notifications" on the user settings screen.

This is absolutely the right way to do it. A little unobtrusive in-page suggestion to enable notifications is not a problem; I've enabled them for Slack via such a notification, for instance. But I'm never going to grant a site notification permission if it pops up the browser permission dialog without interaction.