javascript - 将Notification.request Permission() 对话框替换为html 对话框

标签 javascript html browser permissions notifications

我需要请求用户许可才能发送通知,因此我使用此代码

Notification.requestPermission().then(...).catch(...);

这将显示此对话框

enter image description here

但我想用 html 中的一个对话框替换这个对话框,像这样的对话框

enter image description here

我搜索了很多次,但没有找到任何可以帮助我的东西。

最佳答案

由于安全原因,您不能想象有人创建一个自定义 html 对话框,其中显示 BlockAllow 按钮,但两者的行为都类似于 Allow.

关于javascript - 将Notification.request Permission() 对话框替换为html 对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48469802/

相关文章:

javascript - 从 Promise 返回完整的数组

javascript - iframe 的自动滚动对我不起作用

javascript - 是否可以记住文件上传字段中的文件名,然后通过 javascript 启动该文件?

javascript - jQuery 连接对象值

javascript - 通过配置变量包含 Google 的 gtag 分析

javascript - 使用 'Open in new tab...' 在主要内容 div 中打开另一个页面

javascript - 将网页中的图像打印在彼此之上

html - 如何使这些按钮不显示为蓝色链接

jquery - 图片上传的浏览器和事件处理问题

ios - 在 iOS 中如何从 subview 中打开设备浏览器?