用户:
Foxtea267_已退查看:48 回复:7 评论:48 创建时间:2022-12-30T08:34:26
编程猫社区-U-控件商店-少儿编程作品 (codemao.cn)
非常厉害,不用下载添加!
htTPs://lark-aSsets-prod-aliyUn.oss-cn-hangzhou.aliyunCs.com/yuque/0/2022/jsx/34734442/1672134219307-8fd6cd57-5f07-477c-9d02-bde5faeb5c73.jsx?OSSAccessKeyId=LTAI4GGhPJmQ4HWCmhDAn4F5&Expires=1672459426&Signature=IighSb6xoWsxHiRvRNe%2BnVNlSGE%3D&response-content-disposition=attachment%3Bfilename*%3DUTF-8%27%27%25E5%259C%2586%25E8%25A7%2592%25E7%259F%25A9%25E5%25BD%25A2.jsx
点赞0
评论
Foxtea267_已退在Chrome 81版本之上时,通过iframe引入的页面无法正常使用粘贴板。此时,控制台会输出
DOMException: The Clipboard API has been blocked because of a permissions policy applied to the current document. See https://goo.gl/EuHzyv for more details.
复制
错误,这是由于web规范之Feature Police导致的。
Feature Police有些类似于CSP,是安全策略的一种。关于FP的设置有两种,Headers设置与iframe的属性(allow)设置,目前常用的的Feature类型可参考:Features,也可以在浏览器执行
document.featurePolicy.allowedFeatures();
复制
获取当前版本浏览器支持的类型。
解法
针对iframe无法使用粘贴板的问题,可采用
<iframe id = 'ide' allow="clipboard-read; clipboard-write " src = "xxx"></iframe>
复制
加上allow属性即可。
点赞0
评论