iframe - 加载 apex iframe 时出现内容安全策略错误
问题描述
问题:我们的 Visualforce 页面集成出现 CSP(内容安全策略)错误。
问题是当我们在沙盒测试中访问它时,我们发现我们的内容被包装在一个 iframe 中,并且该 iframe 也包含一个 iframe。
外部 iframe 似乎没有 URL,因此我们无法将其从 CSP 白名单中排除。
apex 将 iframe 动态地放入另一个没有任何 src 的 iframe 中,这就是为什么我们无法将可以打开我们网站的域列入 iframe 的白名单。
- 这是示例父 iframe。
<iframe allow="geolocation *; microphone *; camera *" frameborder="no" height="1000px" id="0661b0000004nmw" marginheight="0" marginwidth="0" name="0661b0000004nmw" scrolling="yes" title="HelloWorld" width="100%">
<iframe src="https://example.com"> </iframe>
</iframe>
- 来自浏览器开发者控制台的错误日志。
[Report Only] Refused to display 'https://example.com' in a frame because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self' *.salesforce.com".
请让我知道在这种情况下是否有解决内容安全错误的方法!
解决方案
推荐阅读
- javascript - 如何在 Moment.js 中从小时和分钟创建全职字符串?
- apache-spark - 如何使用 '\t' 分隔符以文本格式保存 df?
- docker - 不能使用在 Ubuntu 容器上运行的 docker 来执行 cd?
- c# - XAttribute.SetValue 转换“
- javascript - 仅替换数组的最后一项
- pyqt5 - 如何在 PyQt5 小部件中打开 OSM?
- python - 更改元组的每个实例
- python - 在 windows 和 linux 中读取具有相对 url 的文件夹中的所有文件
- python - 从字符串中删除特定字符
- python - 我正在尝试验证数据框中的电话号码