How to Have a Website send Notifications (HTML, CSS, and JS)
Go to solution
Solved by colonel_mortis,
You can't send notifications from any browsers on iOS, because Apple wants you to make a proper app instead. For other browsers, you have two options:
- The web notification API is supported in all modern desktop browsers, but it not supported on most mobile browsers (as I understand it, you can make it work on Chrome on Android but it's not as straight forward as other platforms) and requires you to have a tab open to send the notifications. That tab is responsible for figuring out (eg by polling the server) when to send a notification. That's the method used for notifications through the forum. You can see some example code, as well as more complete docs, on MDN.
- The Web Push API (part of the progressive web app specification) lets you send notifications from the sever, which are pushed to the user's device even if they don't have the tab open. It's a bit more complicated to implement, but it's much more powerful and is supported on desktop and mobile browsers other than iOS and Safari. The Google developer docs are good for push (but there's a lot to them).
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now