Browser support for "//domain.com" [duplicate]
Possible Duplicate:
Is it valid to replace开发者_运维知识库 with // in a <script src=“…”>?
Do all browsers support referencing without the leading http:
or https:
?
For example:
<a href="//example.com/account">
<img src="//example.com/image.gif">
Which should automatically use whatever connection the user currently has (HTTP or HTTPS)
Can I get into trouble if I use this everywhere in my app?
Basically, I want to keep "absolute" URLs consistent, without having to make sure I added https:
if the user is on a secure connection (so he doesn't get warnings), and http:
when he is not on a secure connection (so assets load faster — no HTTPS handshaking).
If you do not count Internet Explorer as a browser, yes, almost every general browsers supports this.
Now seriously: I didn't try it in IE, but every general browser does support this!
精彩评论