vue iframe 报错问题 浏览器监测到了iframe中存在不安全的链接正在尝试进行导航

报错信息如下
Unsafe JavaScript attempt to initiate navigation for frame with URL ‘http://xxxx’ from frame with URL ‘http://yyyy’. The frame attempting navigation is targeting its top-level window, but is neither same-origin with its target nor has it received a user gesture

在iframe加上这个代码之后 sandbox="allow-scripts allow-top-navigation allow-same-origin"
sandbox包含的属性及作用:

allow-forms :允许进行提交表单;

allow-scripts :运行执行脚本;

allow-same-origin: 允许同域请求,比如ajax,storage;

allow-top-navigation: 允许iframe能够主导window.top进行页面跳转;

allow-popups: 允许iframe中弹出新窗口,比如,window.open,target=”_blank”;

allow-pointer-lock: 在iframe中可以锁定鼠标,主要和鼠标锁定有关。
  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值