javascript - iframe 中如何禁用功能策略?
问题描述
我在复制文本的页面上有一个监听器。
obj['this'].shadowRoot.querySelector(`div.${item}`).addEventListener('click',async (event)=>{
event.currentTarget.style.background = '#faf671'
let object = event.currentTarget
let value = object.querySelector('p.value').innerHTML
await navigator.clipboard.writeText(value)
let timer = setTimeout((event)=>{
object.style.background = '#4c6499de'
clearTimeout(timer);
}, 250);
})
然后我在 iframe 中打开页面并收到此错误:
waves-provider.mjs:831 Uncaught (in promise) DOMException: Disabled in this document by Feature Policy.
我添加了允许
但在互联网上我看到了例子
allow="document-write https://www.google.com"
allow="fullscreen 'none'; geolocation 'none'"
但这是行不通的。
解决方案
推荐阅读
- aws-api-gateway - AWS 开发人员门户 - 类型错误:无法获取
- php - 使用 PHP #2 通过 SSL 将 AWS EC2 实例连接到 RDS MySQL
- java - 运行 Java 代码时出现一些错误
- python - 如何使用sql查询获取表中存在的所有行,其中年份是闰年
- mongodb - 直到昨天才使用 python / pymongo 将 JSON 数据插入 MongoDB
- selenium - Selenium 点击功能键
- prolog - 查找连接时给出给定列表的所有子列表列表
- python - Pycharm文件读取程序在调试模式下工作但在发布模式下失败?
- python - 使用 strptime 的日期转换跳过 UTC 部分
- python - 如何在networkx中使用python随机排列图的节点?