How do I use protocol-relative URLs in IE9?
UPDATE
This was neither IE9 nor the plugin. It was the fault of the person using the plugin.
Original Question
I have an image at example.com/imag开发者_开发技巧e.png
that I'd like to use in a Javascript plugin on both HTTP and HTTPS pages. The plugin currently sets the URL to
//example.com/image.png
Most browsers turn that into http://example.com/image.png
or https://example.com/image.png
propertly. When the page is viewed in IE9 over HTTPS, however, the URL gets turned into https:////example.com/images.png
. That is, IE9 prepends "https://"
, not just "https:"
. How do I get IE9 to properly handle protocol-relative URLs?
If you cannot find out what is happening then you can easily resolve the url's yourself by passing location.protocol + url
to the plugin instead of just url
.
精彩评论