Skip to content

Instantly share code, notes, and snippets.

@pingyen
Last active August 29, 2015 21:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pingyen/47532 to your computer and use it in GitHub Desktop.
Save pingyen/47532 to your computer and use it in GitHub Desktop.
Put JS into Iframe 2
<iframe id="_if2" scrolling="no" style="width : 100%" ></iframe>
<script>
(function() {
var oIf = document.getElementById('_if2'),
win = oIf.contentWindow,
doc = oIf.contentWindow.document;
doc.write('<html><head></head><body><script src="http://www.lucido-l.jp/blogparts/parts.js" ></sc' + 'ript>');
if(doc.all) {
var scArr = doc.getElementsByTagName('script'),
oSc = scArr[scArr.length - 1];
_check();
return;
function _check() {
var rs = oSc.readyState;
if(rs == 'loaded' || rs == 'complete') {
doc.write('<script> writeTag(10, 13, 17, 22); </sc' + 'ript><body></html>');
doc.close();
_height();
return;
}
setTimeout(_check, 100);
}
}
win.onload = _height;
doc.write('<script> writeTag(10, 13, 17, 22); document.close(); </sc' + 'ript><body></html>');
function _height() {
oIf.style.height = doc.body.scrollHeight + 'px';
}
})();
</script>
@pingyen
Copy link
Author

pingyen commented May 11, 2015

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