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> Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.