'Html 5 notification not working in Mobile browser
i have implemented HTML5 notification API in my Reactjs application, it's working fine in my desktop,the notifications are coming. But when opening the site in my mobile phone,the notifications are not working.
How can i fix this Issue in my Reactjs application.
useEffect(() => {
console.log("permission" + window.Notification.permission);
if (
(window.Notification && Notification.permission !== "denied") ||
(window.Notification && Notification.permission === "default")
) {
Notification.requestPermission();
}
}, []);
const showNotification = () => {
const options = {
label: "New notification",
body: "notification body"),
icon: icon,
badge: icon,
};
const notification = new Notification(t("New "), options);
setTimeout(() => {
notification.close();
}, 5 * 1000);
};
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
