// Prevent variables from being global //This Javascript is to prevent white flashes with the iframe tag. //you need to put style="visibility:hidden;" onload="this.style.visibility = 'visible';" in the iframe tag otherwise the iframe will not show (function () { /* 1. Inject CSS which makes iframe invisible */ var div = document.createElement('div'), ref = document.getElementsByTagName('base')[0] || document.getElementsByTagName('script')[0]; div.innerHTML = ''; ref.parentNode.insertBefore(div, ref); /* 2. When window loads, remove that CSS, making iframe visible again */ window.onload = function() { div.parentNode.removeChild(div); } })();