This is what i want to do. I want to create a hidden iframe in javascript that points to external website and then use javascript to get the html source code of that hidden iframe into a textbox and as variable(possibly doing some error checking if iframe doesn’t load and ask the user to reload…) so far i tried this but how to make it hidden and read source code from it ?Thanks in advance.
<script language="JavaScript" type="text/javascript">
ifrm = document.createElement("IFRAME");
ifrm.setAttribute("src", "http://www.somesite.com/");
ifrm.style.width = 640+"px";
ifrm.style.height = 480+"px";
document.body.appendChild(ifrm);
</script>
You can’t do that with iframe because of Same Origin Policy, but you can using some server side, using php it will be something like:
and you can call that script with ajax (using jQuery it will be)