2011-08-13 96 views
1

我有這個jsp頁面包含以下框:如何從框架中獲取網址?

<frameset cols="20%,*"> 
    <frame src=」SideBar.jsp」 name="frameA"> 
    <frame src=」http://www.w3schools.com/」 name="frameB" target="_self"> 
</frameset> 

在frameB,這是一個外部鏈接,用戶可以瀏覽該網頁並點擊鏈接和做的東西。用戶點擊鏈接時是否有辦法獲取新網頁的網址?例如http://www.w3schools.com/html/default.asp

在此先感謝

+0

見http://stackoverflow.com/questions/44359/how-do-i -get-the-current-location-of-iframe/836393#836393(僅限IE)和http://stackoverflow.com/questions/44359/how-do-i-get-the-current-location-of -an-iframe/666832#666832(iframe)。 – giraff

回答

0

你嘗試:

alert(frameB.location); 

根據不同的瀏覽器,這可能會被禁用due to security reasons

(你不知道當用戶點擊一個頁面,所以你應該定期檢查它是否改變了。)