[英]Desktop Notification JS workS on Firefox but not on Chrome?
I'am trying to develop a desktop notification JS in my customer application. 我正在尝试在客户应用程序中开发桌面通知JS。 The code works fine on firefox but not on Chrome.
该代码可在Firefox上正常运行,但不能在Chrome上运行。 I'm changing the notification permission to allow on settings -> Advanced -> Content Settings -> Notifications -> Allow/Deny but still not working.
我正在将通知权限更改为允许设置->高级->内容设置->通知->允许/拒绝,但仍然无法使用。
this is my code : 这是我的代码:
notifyMe: function () { 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.
谢谢。
You can activate it on Chrome by clicking on the lock inside the URL bar, on the left. 您可以通过点击左侧网址栏中的锁在Chrome上激活它。
I tried in Firefox and it work, pls consider this Chrome behaviour: 我在Firefox中尝试过,并且可以正常工作,请考虑以下Chrome行为:
https://www.chromestatus.com/feature/6451284559265792 https://www.chromestatus.com/feature/6451284559265792
It's no longer possible to ask for permission from a cross-origin iframe. 不再需要跨源iframe寻求许可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.