iframe方式嵌入禅道,任务编辑中点击保存后出现无法跳转

回贴
回帖数 5
阅读数 3974
发表时间 2020-10-12 11:19:58
🍞
王海甘 楼主

iframe方式嵌入禅道,进行任务编辑,点击保存后无法正常跳转

提示iframe 沙箱保护,无法跳转,即通过parent.location=‘/zentao/task-view-2.html’无法跳转

详细信息:

task-edit-2.html:1 Unsafe JavaScript attempt to initiate navigation for frame with URL 'https://dev-bnmall.bnretail.cn/zentao/task-edit-2.html' from frame with URL 'https://dev-bnmall.bnretail.cn/zentao/task-edit-2.html'. The frame attempting navigation is sandboxed, and is therefore disallowed from navigating its ancestors.

(anonymous) @ task-edit-2.html:1
task-edit-2.html:1 Uncaught DOMException: Failed to set the 'href' property on 'Location': The current window does not have permission to navigate the target frame to '/zentao/task-view-2.html'.
    at https://dev-bnmall.bnretail.cn/zentao/task-edit-2.html:1:90

5个回复
禅道-Bee 沙发

iframe 沙箱保护,可以参考下这两篇资料试试:

https://www.w3school.com.cn/tags/att_iframe_sandbox.asp

https://www.jianshu.com/p/df102bbe94b9

2020-10-12 16:24:38 禅道-李锡碧 回帖
🍞
王海甘 板凳 回复#1

已设置了sanbox属性配置,还是不行

<iframe
          :src="src"
          style="width:100%;height: calc(100vh - 75px);border:none"
          sandbox="allow-same-origin allow-top-navigation allow-scripts allow-forms allow-modals allow-orientation-lock allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-presentation"
        />
2020-10-12 16:47:43 王海甘 回帖
禅道-Bee #3
这样设置之后,js错误又提示什么了呢?可以截图看下。
2020-10-12 17:28:30 禅道-李锡碧 回帖
🍞
王海甘 #4 回复#3

还是那个报错,初步分析可能的原因是,parent.location='xxx' 这个parent 不是顶层window,是第二层iframe, 这时候就无权限操作了,不知道如何解决?

2020-10-12 17:55:16 王海甘 回帖
禅道-Bee #5
联系下官网顶部商务QQ,邀请加入二次开发群,可以在群里沟通确认下。
2020-10-13 17:31:06 禅道-李锡碧 回帖
联系人
杨苗/高级客户经理
电话(微信)
13165050229
QQ号码
2692096539
联系邮箱
yangmiao@chandao.com
返回顶部
杨苗
高级客户经理
13165050229
2692096539
统一服务热线 4006-8899-23
我要提问提问有任何问题,您都可以在这里提问。 问题反馈反馈点击这里,让我们聆听您的建议与反馈。