【问题标题】:Reload parent iframe from child popup从子弹出窗口重新加载父 iframe
【发布时间】:2013-05-03 18:16:16
【问题描述】:

我有一页说 display.aspx 正在 Iframe 中的其他站点中使用。在 display.aspx 页面中,我有一个按钮可以打开 Facebook 弹出窗口进行共享。成功分享后,它会在我网站的一个页面中回复我说 FBResponse.aspx。从 FBResponse.aspx,我想重新加载 display.aspx 页面。

我试过了
1) window.opener.history.go(0);
2) window.opener.location.reload(false);
3) opener.location.reload(false);

但这些都不适合我。

此外,我在 display.aspx 页面中创建了一个函数,在该函数中我编写了代码来重新加载页面。我尝试从 FBResponse.aspx 调用此函数,但在 Chrome 中我收到错误 请求访问的帧具有“https”协议,正在访问的帧具有“http”协议。协议必须匹配,并且在 FF 中我收到错误 Permission denied to access in IFRAME 中的属性。实际上,我的网站正在使用 https,因为使用我的页面 display.aspx 的网站可能正在使用 http 协议。

有什么解决办法吗?

谢谢,
普里亚

【问题讨论】:

    标签: javascript jquery asp.net iframe popup


    【解决方案1】:

    嘿试试这个。

    <form onsubmit="window.top.location.href = 'http://www.wesite.com/test.html';">
    

    注意 iframe 和 top 必须在同一个域中,并且不要违反同源策略。

    希望对你有帮助。

    【讨论】:

    • 试试这个parent.location.reload(); 也参考这些链接Link1Link2。希望对你没问题。享受编码。
    【解决方案2】:

    除非页面和 iframe 具有相同的域,否则您不能(在这种情况下,您可以使协议匹配)。同源策略可能会出现偏差。

    【讨论】:

    • Iframe(display.aspx) 中使用的页面和我要从中重新加载 display.aspx 的页面(fbresponse.aspx) 都具有相同的域。但是 display.aspx 用于与我不同的站点。会影响吗?
    • 如果它们在同一个域中并且您使用同一个域来访问它们,那么您应该能够做您需要的事情。理论上至少:)。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多