Search code examples
mysqlgoogle-chromegoogle-chrome-extensionnotifications

How to create a notification chrome extension?


i want to create a google chrome extension that notify user when a new record in the mysql DB is added ! there is someone who can help me ? Thank you.


Solution

  • Please refer to this page.

    Use the chrome.notifications API to create rich notifications using templates and show these notifications to users in the system tray.

    https://developer.chrome.com/docs/extensions/reference/notifications/

    chrome.notifications.create(
      "name-for-notification",
      {
        type: "basic",
        iconUrl: "image.jpeg",
        title: "This is a notification",
        message: "hello there!",
      },
      function () {}
    );
    

    You can create notification like this.
    EDIT: Please do not forget to add the "notifications" permission in the manifest.json file