简体   繁体   English

由于iframe导航,如何在浏览器中更改网址?

[英]How to change the URL in browser due to the navigation at iframe?

I want to change the URL in browser based on the iframe navigation like: 我想根据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>

When the user clicks the #mypage link the URL in the browser will be: 当用户单击#mypage链接时,浏览器中的URL将为:

http://localhost/mypage/

Not matters that the src of the iframe be the same always. 并不重要的是iframe的src总是一样的。

¿Is that possible? 那可能吗?

Maybe using ajax.........?? 也许使用ajax ......... ??

看看: Html5历史api

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM