//namespace our global vars // TODO: turn this into a class with any functions as methods of IDXPRO.app? if (!IDXPRO) var IDXPRO = {}; if (!IDXPRO.app) IDXPRO.app = {}; //test to see if this browser understands the "right" way function isModernBrowser() { return (typeof window.postMessage == 'function'); } function handleMessage(msg) { pieces = msg.split(':'); switch (pieces[0]) { case 'setHeight': document.getElementById("IDXProAppFrame").style.height = pieces[1] + "px"; break; default: //alert("unknown command"); } } if ( isModernBrowser() ) { // in the case of a modern browser, we need to have an event handler function receiveMessage( event ) { return handleMessage(event.data); } window.addEventListener("message", receiveMessage, false); } // end if modern browser else { // For a fallback, the child window will put it's message on our URL. If it's there, // extract and process it, and reset the url to be the "clean" value function checkURLForMessage() { var hashstring = document.location.hash; if (document.location.hash.length > 1 && hashstring.indexOf('setHeight') != -1 ) { // IE doesn't properly clear hash, so we need to strip off any number of # signs handleMessage(hashstring.replace(/^#*/, '')); document.location.hash = '#'; } } // check the url about 3 times a second. IDXPRO.app.iframe_timer = setInterval( function() { checkURLForMessage(); }, 300); }// end if old-style browser // now build and insert the display iframethat will show our content. IDXPRO.app.parent_url = escape(document.location.href); // if our parent is an https, and we have a secure host, use the secure host var parent_href_value = document.location.href; var normal_host = 'http://idxpro.cisdata.net'; var secure_host = 'https://idxpro.cisdata.net'; var use_host = (parent_href_value.indexOf("https") == 0) ? secure_host : normal_host; IDXPRO.app.display_html = ""; document.write(IDXPRO.app.display_html);