jQueryCode = function(){ var url = "https://www.niusnews.com/ui/vnweddings"; if(location.search != ""){ if(location.search.indexOf("?pid=") >= 0){ pid = location.search.substr(location.search.indexOf("?pid=") + 5,8); url = "https://www.niusnews.com/ui/vnweddings_view/"+pid; } } jQuery('#post-container').html(""); function receiveMessageFromIframePage (event) { if(event.data.type == "height"){ jQuery('#post-iframe').css("height",event.data.height+"px"); } } window.addEventListener("message", receiveMessageFromIframePage, false); } if(window.jQuery) jQueryCode(); else{ var script = document.createElement('script'); document.head.appendChild(script); script.type = 'text/javascript'; script.src = "https://code.jquery.com/jquery-2.2.4.min.js"; script.onload = jQueryCode; }