使用“//”启动网址并省略“http:”的效果是什么? [英] What is the effect of starting a url with "//", and leaving out "http:"
本文介绍了使用“//”启动网址并省略“http:”的效果是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我最近注意到like和tweet按钮的嵌入代码不包含http协议。例如:
I recently noticed that the embed codes for the "like" and "tweet" buttons don't include the http protocol. For example:
<script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=555";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
他们为什么要这样做?
推荐答案
根据您的网站使用的协议,http,https,spdy等,它将使用与您的网站使用的协议相同的协议。换句话说,它将使用当前使用的协议。
Depending on the protocol used by your website, http, https, spdy, etc, it will use the same protocol than your website is using. In other words it will use the currently used protocol.
这篇关于使用“//”启动网址并省略“http:”的效果是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文