【发布时间】:2018-06-18 16:05:33
【问题描述】:
我知道这个问题已经在这里被问过好几次了,但我无法找到完美的工作解决方案。
我正在尝试将我的 Angular 4 应用程序 URL 嵌入到 Iframe 中:
<html>
<body>
<iframe src="http://localhost:4300/login" height="200"></iframe>
</body>
</html>
但是,当我打开此页面时,我看不到我的应用程序正在运行。我发现这个问题与 CORS 有关,但我无法找出确切的解决方案。
在我的浏览器控制台上,我收到以下错误:
ERROR DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
at t._loadLevel (http://localhost:4300/vendor.0a81172ada1f31f3dc62.bundle.js:1:927903)
现有的类似问题:
How to open a iframe link within the same iframe?
how to resolve iframe cross domain issue
https://github.com/apollographql/apollo-client-devtools/issues/106
https://github.com/disconnectme/disconnect/issues/315
请帮帮我。
【问题讨论】:
-
“我知道这个问题已经在这里被问过好几次了……”,你能发布一两个这些问题的网址吗?我想看看这是否是一种常见做法及其背后的原因。
-
@zer00ne 更新有问题
-
我之所以困惑是因为两个页面在同一个站点上,对吗?
-
@zer00ne 是的,我从堆栈溢出中得到了这个信息,只有你能帮助我,然后它会很棒
-
@zer00ne 我更新了一些链接。