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

时间:2013-02-26 10:03:35

标签: javascript jquery html url iframe

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

**[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 ......... ??

2 个答案:

答案 0 :(得分:2)

答案 1 :(得分:1)

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

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