(no title)
harg | 2 years ago
The correct (IMO) way to use this is to request permission after a user initiates it. E.g. clicking a button somewhere in the UI that says "Enable notifications" whilst being in some context where it makes sense to potentially want to enable them.
This is how the web share API works. Calling `navigator.share()` without user interaction will fail as it requires "transient activation"[2]
[1]: https://developer.mozilla.org/en-US/docs/Web/API/Web_Share_A... [2]: https://developer.mozilla.org/en-US/docs/Glossary/Transient_...
marcosdumay|2 years ago
That question is quite old. Nowadays nobody have that kind of problem.
dathinab|2 years ago
but at least no one who potentially is on HN should have that problem ;=)
whalesalad|2 years ago
First time on the internet?
barryrandall|2 years ago