【问题标题】:How to change the URL in browser due to the navigation at iframe?由于 iframe 的导航,如何更改浏览器中的 URL?
【发布时间】:2013-02-11 17:32:36
【问题描述】:

我想根据 iframe 导航更改浏览器中的 URL,例如:

**[URL at navigator: http://localhost/]**

<html>
<body>
<iframe src="http://localhost/?loadiframe=true">
   <!-- this is at the code retrieved by the iframe -->
   <a id="mypage" href="http://localhost/mypage/?loadiframe=true">Navi</a>
</iframe>
</body>
</html>

当用户单击#mypage 链接时,浏览器中的 URL 将是:

http://localhost/mypage/

iframe 的 src 始终相同并不重要。

¿这可能吗?

也许使用 ajax......??

【问题讨论】:

    标签: javascript jquery html url iframe


    【解决方案1】:

    【讨论】:

      【解决方案2】:

      如果将链接的target 属性设置为_parent,则地址应在父窗口中打开:

      <a id="mypage" href="http://localhost/mypage/?loadiframe=true" target="_parent">Navi</a>
      

      【讨论】:

        猜你喜欢
        • 2014-03-29
        • 2020-07-14
        • 1970-01-01
        • 2020-07-27
        • 2022-01-04
        • 1970-01-01
        • 2016-09-09
        • 2015-07-16
        • 1970-01-01
        相关资源
        最近更新 更多