How do I create a script that returns with an iframe document. I tried this code but it did not work:
function getDocumento(ifrane){
return iframe.document;
}
How do I create a script that returns with an iframe document. I tried this code but it did not work:
function getDocumento(ifrane){
return iframe.document;
}
I suggest using a library for this. With jQuery it would look something like:
function getFrameContents(iframe){
return $(iframe).contents();
}
In the pure javascript version you have to take into account different browsers. Try this:
function getFrameContents(iframe){
var iframeDocument = iframe.contentDocument || iframe.contentWindow.document
return iframeDocument;
}
Notice that your code has the argument name of the function with "n" instead of "m".
Please note that if iframe
is in a different domain you will have limitations of CORS .