簡體   English   中英

由於iframe導航,如何在瀏覽器中更改網址?

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

我想根據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 ......... ??

看看: 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