Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
10148 Zobrazení

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
Zrušit
Autor Nejlepší odpověď

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
Zrušit
Nejlepší odpověď

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
Zrušit