Html 根据在iFrame中打开的页面更改URL
我正在设计一个网站,上面有一个导航栏,下面有一个iFrame。我想做的是,用户将在这个iFrame中浏览整个网站。导航栏将一直在顶部。 当前,我的导航栏链接在我的iFrame中打开一个文档,如下所示:Html 根据在iFrame中打开的页面更改URL,html,iframe,Html,Iframe,我正在设计一个网站,上面有一个导航栏,下面有一个iFrame。我想做的是,用户将在这个iFrame中浏览整个网站。导航栏将一直在顶部。 当前,我的导航栏链接在我的iFrame中打开一个文档,如下所示: <li class="nav-top-links"><a class="a-nav-top-links" href="sample1.html" target="tFrame">ITEM1</a></li> 我想知道的是: 如何根据iFrame
<li class="nav-top-links"><a class="a-nav-top-links" href="sample1.html" target="tFrame">ITEM1</a></li>
我想知道的是:
您可以在iframe和父文档之间传递消息。查看此答案了解详细信息:您可以尝试pushState或哈希键导航 pushState示例:
var stateObj = { foo: "bar" };
history.pushState(stateObj, "page 2", "bar.html");
哈希键示例:
if ("onhashchange" in window) {
alert("The browser supports the hashchange event!");
}
function locationHashChanged() {
if (location.hash === "#somecoolfeature") {
somecoolfeature();
}
}
window.onhashchange = locationHashChanged;
相关主题: