1
How do I create a script that returns with an iframe document. I tried this code but it didn’t work:
function getDocumento(ifrane){
return iframe.document;
}
1
How do I create a script that returns with an iframe document. I tried this code but it didn’t work:
function getDocumento(ifrane){
return iframe.document;
}
6
I suggest using a library for that. With jQuery it would be something like:
function getFrameContents(iframe){
return $(iframe).contents();
}
In the pure javascript version you have to take into account different browsers. Test like this:
function getFrameContents(iframe){
var iframeDocument = iframe.contentDocument || iframe.contentWindow.document
return iframeDocument;
}
Note that in your code you have the function argument name "n" instead of "m".
Bear in mind that if the iframe
is in a different domain will have limitations of CORS.
Browser other questions tagged javascript html
You are not signed in. Login or sign up in order to post.
src from an iframe is a website url.
– FRNathan13