Skip to content

Instantly share code, notes, and snippets.

@timfanda35
Forked from pingyen/jsIframe3.html
Created June 1, 2014 13:51
Show Gist options
  • Save timfanda35/d7a39a41c214ca3c3fbf to your computer and use it in GitHub Desktop.
Save timfanda35/d7a39a41c214ca3c3fbf to your computer and use it in GitHub Desktop.
<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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment