通过Javascript从https页面更新http父页面 [英] Updating a http parent page from a https page via Javascript
问题描述
我有一个不安全的页面,会打开一个安全的(https)页面。安全页面需要通过javascript submit()更新父页面,同时仍然保持当前窗口。但是,当我尝试通过javascript执行此操作时,我收到拒绝访问javascript错误,因为父页面不安全。
I have a unsecure page which opens up a secure (https) page. The secure page needs to update the parent page via a javascript submit() while still remaining the current window. However when I try to do this via javascript I get an "Access Denied" javascript error because the parent page is unsecure.
我知道如何在不安全的情况下访问父页面吗?
Any idea of how I can access the parent page, when it isn't secure?
这是我用来执行提交的javascript代码......
Here is the javascript code that I'm using to perform the submit...
self.opener.parent.frames.item('BODY')。document.forms [0 ] .submit();
self.opener.parent.frames.item('BODY').document.forms[0].submit();
推荐答案
浏览器中的Same-Origin-Policy意味着您无法直接执行此操作。 Origin由Scheme / Protocol和Hostname组成。在您的情况下,方案不匹配,因此跨文档请求被阻止。
Same-Origin-Policy in browsers means that you cannot do this directly. The "Origin" is composed of Scheme/Protocol and Hostname. In your case, the scheme mismatches, so the cross-document request is blocked.
您可以使用明确的x-frame通信技术(Fragment Identifier Messaging或HTML5 PostMessage)来向外页发送消息以执行事件处理程序。
You can use explicity x-frame communication techniques (Fragment Identifier Messaging or HTML5 PostMessage) to send a message to the outer page to execute an event-handler.
这篇关于通过Javascript从https页面更新http父页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!