Skip to Content
Menu
This question has been flagged
2 Replies
9356 Views

Hi 

I'am trying to doevelop a desktop notification JS in odoo10 . My  code work on firefox but not on Chrome

 I changing  the notification permission on allow but still not working.

this is my code : 

notifyMe: function () {

         if (!("Notification" in window)) {

           alert("Ce navigateur ne supporte pas les notifications desktop");

         }

         else if (Notification.permission !== 'denied') {

          Notification.requestPermission(function (permission) {

             if(!('permission' in Notification)) {

               Notification.permission = permission;

             }

             if (permission === "granted") {

              var notification = new Notification("Notify ")

             }

           });

         }

 Can somebody help me ? Thanks

Avatar
Discard
Author Best Answer

Hi Hilar thanks for your reply

the permission is requested on chrome but the notification itself is not displayed.the code work fine with firefox but with chrome it show this message on console "The Notification API may no longer be used from insecure origins.You should consider switching your application to a secure origin, such as HTTPS"

Avatar
Discard
Best Answer

Hi this is related with chrome browser settings.

Note :- Ensure you are using HTTPS. Chrome notifications works only on https.

Goto -> settings -> Advanced -> Content Settings -> Notifications -> Allow/Deny

chrome://settings/content/notifications

Avatar
Discard