Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Put JS into Iframe 3
<iframe id="_if3" scrolling="no" style="width : 100%" ></iframe>
<script>
(function() {
var oIf = document.getElementById('_if3'),
win = oIf.contentWindow,
doc = oIf.contentWindow.document;
doc.write('<html><head></head><body><script> google_ad_client = "pub-1821434700708607"; google_ad_slot = "8156194155"; google_ad_width = 200; google_ad_height = 200; </sc' + 'ript><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></sc' + 'ript>');
if(doc.all) {
var ifArr = doc.getElementsByTagName('iframe');
_check();
return;
function _check() {
if(ifArr.length) {
doc.close();
_height();
return;
}
setTimeout(_check, 100);
}
}
win.onload = _height;
doc.write('<script> document.close(); </sc' + 'ript><body></html>');
function _height() {
oIf.style.height = doc.body.scrollHeight + 'px';
}
})();
</script>
@pingyen

This comment has been minimized.

Copy link
Owner Author

@pingyen pingyen commented May 11, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment