Sunday, December 15, 2024
HomeiOS Developmentjavascript - Notifications despatched from browser API would not work on iOS

javascript – Notifications despatched from browser API would not work on iOS


That is NOT about push notifications. It is about commonplace HTML5 browser api notifications (https://developer.mozilla.org/en-US/docs/Net/API/Notification)

Prerequisite:

  • App which is a vueJS SPA app was put in on iOS dwelling display.
  • Notification.permission === “granted” was obtained

That is within the context of a Javascript VueJS non native app.
Code used to ship notifications:

const sendnotification = () => {
  strive {
    new Notification(`Alert title`, {
      physique: `alert physique`
    });
    flashMessageStore.setMessage("Notification was despatched", 'data');

    console.log("Notification despatched");
  } catch (error) {
    alert("sendnotification: ", error);
  }
};

No error is proven, it is as if nothing occurs: notification simply do not seem.
It really works completely on dekstop browser. Not on Chrome cell (have not examined different cell browsers).

  • I did not put in particularly an online service employee. Ought to I ?
  • What could possibly be the issue ?
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments