Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- window.addEventListener("load", function(){
- if(window.self === window.top) return; // if w.self === w.top, we are not in an iframe
- function send_height_to_parent_function(){
- var height = document.getElementsByTagName("html")[0].clientHeight;
- //console.log("Sending height as " + height + "px");
- parent.postMessage({"height" : height }, "*");
- }
- // send message to parent about height updates
- send_height_to_parent_function(); //whenever the page is loaded
- window.addEventListener("resize", send_height_to_parent_function); // whenever the page is resized
- var observer = new MutationObserver(send_height_to_parent_function); // whenever DOM changes PT1
- var config = { attributes: true, childList: true, characterData: true, subtree:true}; // PT2
- observer.observe(window.document, config); // PT3
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement