İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
10145 Görünümler

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
Vazgeç
Üretici En İyi Yanıt

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
Vazgeç
En İyi Yanıt

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
Vazgeç