Browser Push Notification Using LWC

Browser Push Notification Using LWC
Browser push notifications are clickable messages that a website can send to their subscribers, directly on their desktop or mobile device.

Requirement is to trigger a browser push notification using lightning web component. we can achieve this using native JavaScript notification function. 


Below is the sample code:

LWC (HTML) :


LWC (JS) :



Now we can add this LWC component on the home page.
  • Go to Home page
  • Click Setup (Gear Icon) and select Edit Page.
  • Under Custom Components, find your LWC component and drag it on right-hand side.
  • Click Save and activate.

Microsoft Edge :


Chrome :


Final Output:



2 Comments

  1. content are not align in center, its showing as an left alignment, that's why not able to read all.

    ReplyDelete
    Replies
    1. Sorry, for the inconvenience caused. blog has been redesigned to fix the older bugs an improve performance. hope your should not face such issue in near future. Happy New Year! :-)

      Delete