我创建了一个chrome扩展程序,该扩展程序还使用Web API-Notification生成了通知。
问题是当我调用Notification.requestPermission()时,它不会询问权限,并且不会显示通知。
观察结果:
我该怎么解决?
编辑:我的代码。
if (Notification.permission !== "granted") {
Notification.requestPermission()
.then(function() {});
};
当我调试代码Notification.permission ===“ default”时。
通过在manifest.json中添加“ notifications”权限来修复此问题
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句