{"id":15,"date":"2008-05-26T15:51:55","date_gmt":"2008-05-26T13:51:55","guid":{"rendered":"http:\/\/kinsey.no\/wp\/?p=15"},"modified":"2021-06-22T00:49:10","modified_gmt":"2021-06-21T22:49:10","slug":"this-page-contains-both-secure-and-nonsecure-items","status":"publish","type":"post","link":"https:\/\/kinsey.no\/blog\/index.php\/2008\/05\/26\/this-page-contains-both-secure-and-nonsecure-items\/","title":{"rendered":"&#8220;This page contains both secure and nonsecure items.&#8221;"},"content":{"rendered":"<p>With one of my larger webapps I have recently been struggling with the following Security Information message in Internet Explorer:<\/p>\n<p>This page contains both secure and nonsecure items.<\/p>\n<p>Do you want to display the nonsecure items?<\/p>\n<p>This, in general, has to do with mixing of content from different security zones in IE, for example Internet and Local, or http and https.<br \/>\n<!--more--><br \/>\nI&#8217;ve had my go at Google and there are indeed loads of sites where this, and solutions to it has been brought up, but none of these applied to my application.<br \/>\nTo sum it up, most solutions consists of checking the following<\/p>\n<ul>\n<li>That all URL&#8217;s are either consistent (http or https, not a mix) or relative URL&#8217;s<\/li>\n<li>That all iframes or frames written in markup has a src set<\/li>\n<li>That all iframes or frames created with javascript and added to the DOM has a src set prior to adding<\/li>\n<li>That all resources resolve and do not generate a 404, (the 404 page is considered local zone)<\/li>\n<\/ul>\n<p>After checking all of these off, my application was still throwing the same error, and something I had read a long time a go bubbled up.<br \/>\nIE will treat all images that has a relative src set with <a href=\"https:\/\/xcellr8.health\" style=\"color:#333\">hormone therapy Scottsdale<\/a> through the DOM as an insecure element!<br \/>\nTherefor my solution was to create a resourceBase variable that I use to prefix all the previously relative paths with.<br \/>\nThe simplest way to do this is by:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">var resourceBase=window.location.protocol + &amp;amp;quot;\/\/&amp;amp;quot; + window.location.host +&amp;amp;quot;\/resources\/&amp;amp;quot;;<\/pre>\n<p>Following is a quick example of a function converting a relative path to an absolute one:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">function relativeToAbsolute(_urlToResolve){\r\nif (_urlToResolve.substring(0, 1) == &amp;amp;quot;\/&amp;amp;quot;) {\r\n_urlToResolve = _urlToResolve.substring(1);\r\n}\r\nvar _documentURI = document.location.href.substring(window.location.protocol.length + 2, document.location.href.lastIndexOf(&amp;amp;quot;\/&amp;amp;quot;));\r\nvar _lastIndexOf = null;\r\nwhile (_urlToResolve.substring(0, 2) == &amp;amp;quot;..&amp;amp;quot;) {\r\n_urlToResolve = _urlToResolve.substring(3);\r\nif ((_lastIndexOf = _documentURI.lastIndexOf(&amp;amp;quot;\/&amp;amp;quot;)) != -1) {\r\n_documentURI = _documentURI.substring(0, _lastIndexOf);\r\n}\r\n}\r\nreturn window.location.protocol + &amp;amp;quot;\/\/&amp;amp;quot; + _documentURI + &amp;amp;quot;\/&amp;amp;quot; + _urlToResolve;\r\n}<\/pre>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>With one of my larger webapps I have recently been struggling with the following Security Information message in Internet Explorer: This page contains both secure and nonsecure items. Do you want to display the nonsecure items? This, in general, has to do with mixing of content from different security zones in IE, for example Internet [&hellip;]<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[34,1],"tags":[8,22],"_links":{"self":[{"href":"https:\/\/kinsey.no\/blog\/index.php\/wp-json\/wp\/v2\/posts\/15"}],"collection":[{"href":"https:\/\/kinsey.no\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kinsey.no\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kinsey.no\/blog\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/kinsey.no\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=15"}],"version-history":[{"count":8,"href":"https:\/\/kinsey.no\/blog\/index.php\/wp-json\/wp\/v2\/posts\/15\/revisions"}],"predecessor-version":[{"id":409,"href":"https:\/\/kinsey.no\/blog\/index.php\/wp-json\/wp\/v2\/posts\/15\/revisions\/409"}],"wp:attachment":[{"href":"https:\/\/kinsey.no\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=15"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kinsey.no\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=15"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kinsey.no\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=15"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}