无法浏览iframe内容的历史记录

问题描述 投票:0回答:1

我正在使用iframe在程序中加载第二个网站。

我为此目的创建了div,其中包含iframe:

<div id='ktmv-help'>
    <iframe id="contextHelp" allowTransparency="true" scrolling="no"
            frameborder="0">
    </iframe>
</div>

当我在程序页面之间导航时,我正在使用$('#contextHelp')[0].contentWindow.location.replace(url);命令以编程方式更改iframe的内容。

问题是通过$('#contextHelp')[0].contentWindow.location.replace(url);命令更改内容后,我无法返回iframe的previos页面。

我尝试过history.back()window.history.back()history.go(-1)命令,但所有命令均无效。我看到相同的iframe页面。

enter image description here

javascript iframe browser-history
1个回答
0
投票

来自文档:

跨域脚本API访问

iframe.contentWindowwindow.parentwindow.openwindow.opener之类的JavaScript API允许文档直接相互引用。 当两个文档的来源不同时,这些引用为窗口和位置对象提供了[[非常受限的访问权限,如以下两节所述。

规格:HTML Living Standard § Cross-origin objects

有关更多信息,请参阅

© www.soinside.com 2019 - 2024. All rights reserved.