10

Possible Duplicate:
Absolute URLs omitting the protocol (scheme) in order to preserve the one of the current page

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>

Why do they do this?

Community
  • 1
  • 1
defrex
  • 15,735
  • 7
  • 34
  • 45
  • may be its adding http automatically.... – Pranay Rana Dec 01 '11 at 15:36
  • 2
    possible duplicate of [Absolute URLs omitting the protocol (scheme) in order to preserve the one of the current page](http://stackoverflow.com/questions/4978235/absolute-urls-omitting-the-protocol-scheme-in-order-to-preserve-the-one-of-the) and many others such as [this one](http://stackoverflow.com/questions/550038/is-it-valid-to-replace-http-with-in-a-script-src-http) – Quentin Dec 01 '11 at 15:37
  • 3
    See also [What are those URL's that are starting with // - that you can see within Google+ html source?](http://stackoverflow.com/questions/6656315/what-are-those-urls-that-are-starting-with-that-you-can-see-within-google) – Matt Ball Dec 01 '11 at 15:37

1 Answers1

9

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.

jValdron
  • 3,408
  • 1
  • 28
  • 44