2011-08-13 104 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

(你不知道当用户点击一个页面,所以你应该定期检查它是否改变了。)