demianturner / sgl-docs-tickets-migration-test

0 stars 0 forks source link

Fixing the IE 8 warning – ‘Do you want to view only the webpage content that was delivered securely?’ #1764

Open demianturner opened 11 years ago

demianturner commented 11 years ago

Internet Explorer 8 gives the following incorrect warning: ‘Do you want to view only the webpage content that was delivered securely?’

{{{

// Causes mixed content message in IE on a secure page document.write(""); document.getElementById("__ie_onload").onreadystatechange = function() { if (this.readyState == "complete") domReady(); };

}}}

It’s a trick used to emulate a DOMContentLoaded event in IE. A security warning occurs because of the use the “javascript:” protocol even though no download occurs.

The fix is to use //: in the src attribute in the same way as popular javascript libraries such as jQuery and prototype. This does cause a harmless ERROR_INVALID_URL entry in HttpWatch, but it avoids the mixed content message:

{{{

// Does not cause a mixed content message in IE on a secure page document.write(""); document.getElementById("__ie_onload").onreadystatechange = function() { if (this.readyState == "complete") domReady(); };

}}}

(Citation from: http://blog.httpwatch.com/2009/09/17/even-more-problems-with-the-ie-8-mixed-content-warning/ )