Does anyone have an idea how to make this XHR request response load the .php file into an iframe as opposed to directly?
var xhr= new XMLHttpRequest();
xhr.open('GET', 'http://example.com/foo/bar/baz.php', true);
xhr.onreadystatechange= function() {
if (this.readyState!==4) return;
if (this.status!==200) return;
document.getElementsByTagName('body')[0].innerHTML = document.getElementsByTagName('body')[0].innerHTML + this.responseText;
};
xhr.send();
Replace this:
document.getElementsByTagName('body')[0].innerHTML = document.getElementsByTagName('body')[0].innerHTML + this.responseText;
with this:
var iframe = document.createElement('iframe');
iframe.srcdoc = this.responseText;
iframe.src = "data:text/html;charset=utf-8," + escape(this.responseText);
document.body.appendChild(iframe);
Alternatively, if you just want to display the page in an iFrame without making the XHR request. Just use this as your code:
var iframe = document.createElement('iframe');
iframe.src = 'http://derrick.dk/ogmobi/facebook/contentLockerFacebook.php';
document.body.appendChild(iframe);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With