开发者

Browser support for "//domain.com" [duplicate]

This question already has answers here: Closed 11 years ago.

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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜