未知的Domexception:用原点“ http://subdomain.lvh.me:3000&quot”阻止了一个框架。从访问跨原始框架(http://lvh.me:3000)
好吧,我正在尝试在我的子域页面上运行一个iframe或window。在我的子域页面上打开,以访问域页面以供Google登录权限。但是我遇到了交叉起源错误。
我的主要页面是: http://subdomain.lvh.me:3000
,当我单击按钮时,打开或iframe用URL打开(没有区别): http://lvh.me:3000
但是,通过这种方式,我无法访问iframe.contentwindow.document to从主页获取IFRAME内容值。这就是情况: image错误
,当我尝试通过window.postmessage发送时,这是错误:这是错误: postmessage错误
无法在'domwindow'上执行'domwindow'''''': ://subdomin.lvh.me:3001')与收件人窗口的原点不匹配('http://lvh.me:3001')。
Well, I'm trying to run an iframe or window.open in my subdomain page to access the domain page for Google Login permission purposes. But i'm getting the cross origin error.
My principal page is:
http://subdomain.lvh.me:3000
And when I click on the button, a new pages open or the iframe opens (does not make difference) with the URL:
http://lvh.me:3000
But in this way I can't access iframe.contentWindow.document to get the iframe content value from the principal page. That is the situation:
Image error
And, when I try to send by window.postMessage, this is the error:
postMessage error
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('http://subdomin.lvh.me:3001') does not match the recipient window's origin ('http://lvh.me:3001').
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要在使用poste术时设置靶标领域到另一个域
You need to set the targetOrigin field when using postMessage to another domain