Skip to content

Instantly share code, notes, and snippets.

@benweiser
Last active July 5, 2016 16:49
Show Gist options
  • Save benweiser/7d23e418a93b9097aa7d34d05f3ee92a to your computer and use it in GitHub Desktop.
Save benweiser/7d23e418a93b9097aa7d34d05f3ee92a to your computer and use it in GitHub Desktop.
Code for child page to post scrollHeight data to parent window
!function(){window.onload=function(){function n(){window.parent.postMessage(document.documentElement.scrollHeight,"*")}var o=function(t,i){setTimeout(function(){n(),i&&o(t+100,--i)},t)};window.onload=o(500,10),window.onresize=function(){n()},window.addEventListener?window.addEventListener("click",n,!1):window.attachEvent("onclick",n)}}();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment