What exactly are the rules for avoiding the “mixed content” warning in IE due to background images?

后端 未结 3 2159
有刺的猬
有刺的猬 2021-02-19 09:22

This is related to SSL and mixed content due to CSS background images but that question had no accepted answer and the one I\'m asking is a little more specific.

Under s

相关标签:
3条回答
  • 2021-02-19 09:59

    After countless hours of the same problem, I couldn't figure out the problem. I then began picking through my source code and I found it. I'm using HTML5, and I'm using a shiv inside of a conditional comment to make HTML5 elements work in IE8 and down.

    <!--[if lte IE 8]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
    

    My issue was that IE8 and down was throwing an error. That issue was solved by changing the above into a https, with the following:

    <!--[if lte IE 8]><script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
    

    I haven't tested it, but I imagine the following might work too.

    <!--[if lte IE 8]><script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
    

    It might save somebody down the road. If not, then good luck!

    0 讨论(0)
  • 2021-02-19 10:00

    Using the fully-qualified URI will avoid the problem of IE8 and below incorrectly creating a bogus URI like about:/relative/file.png that triggers the mixed content warning. This problem was fixed in IE9.

    0 讨论(0)
  • 2021-02-19 10:00

    I think the reason you're getting different results is not because the one method is "safer," but because the offending URL isn't present in the base document when IE loads it. I expect you'll get the warning if you were to place that A directly in the document instead of scripting it in after the page has loaded.

    If I'm right in my diagnosis, this would mean there's no as-yet-undocumented quirk to the rules about mixed content.

    Also: protocol-relative URLs are awesome. Just in general.

    0 讨论(0)
提交回复
热议问题