I am not able to obtain the links inside an iframe and i don't know why. Maybe you can tell me a solution (i want to do this in javascript). <script> function fget(){ var links = self.frames['rame'].document.links for(var i = 0; i < links.length; i++) { var linkHref = document.createTextNode(links[i].href); document.getElementById("rezult").innerHTML.=linkHref; } } </script> <span onclick="fget();">Click for info</span> <iframe src='http://somesite.with_a_tags.com' width='728' height='=90' name='rame'></iframe> <div id="rezult"></div> Code (markup):
Hello, please add to my gruop http://www.facebook.com/profile.php?id=1366189068&hiq=jesus,porras,povedano thakns
does your code is working fine without iframe if yes then you may try to write this script in the head section of the page which is loading in the iframe probably the problem is that the page is not getting the script function or please provide the error details you are getting
if it didn't worked that means it should be giving you some JavaScript errors can you trace those and tell us what those error description is.. or if you don't know who to traces the error tell me i may help you
+ is used as string concatenation operator in javascript not . (dot) which you seem to be using in this line : document.getElementById("rezult").innerHTML.=linkHref; Also, does the the parent page and the iframe originate from the same domain?
the iframe loads an external page, what i want to do with javascript is to get all the links from the iframe, grabbing the links into an array.
Then it can't be done in javascript, due to javascript security policy. Javascript scripts are not allowed access to webpage in different frame which come from different domain.
it's an external link from other website not mine, ah i didn't know that I'll just have to do this with php then.