MDanz Posted March 10, 2010 Share Posted March 10, 2010 i have a top frame with a webpage. i have a bottom frame with the javascript. I'm trying to get the url of the top frame with javascript. the top frame id is link_frame. the code i tried isn't working. <a style='text-decoration: none' id='point' onclick='Url();'>Get</a> <script type="text/javascript"> function Url() { var CurrentUrl = document.getElementById('link_frame').contentWindow. location.href; alert("CurrentUrl"); } </script> Link to comment https://forums.phpfreaks.com/topic/194757-get-url-help/ Share on other sites More sharing options...
XeNoMoRpH1030 Posted March 10, 2010 Share Posted March 10, 2010 You should be able to access it by using something like the following: var CurrentUrl = top.getElementById('link_frame').location.href; In the one case I had to do something like that, I did top.frameName.location.href; I assume when you use document, it considers the current frame (or document) to be that, so hopefully top will do the trick. And I just noticed this is "Solved", so nvm Link to comment https://forums.phpfreaks.com/topic/194757-get-url-help/#findComment-1024329 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.