10

I'm using Facebook's javascript sdk and it has double forward slashes. What do they mean?

<script src="//connect.facebook.net/en_US/all.js"></script>

I know a single / means root directory, but what is //? Is that telling the source to use http:// and then the path?

Don P
  • 60,113
  • 114
  • 300
  • 432
  • 2
    See here, http://stackoverflow.com/questions/550038/is-it-valid-to-replace-http-with-in-a-script-src-http – NEO Mar 13 '13 at 05:11

3 Answers3

19

This is a "protocol-relative" link. It uses http or https depending on what was used to load the current page.

Thilo
  • 257,207
  • 101
  • 511
  • 656
2

It makes it protocol agnostic, if your page is served using https: it makes the request using https:

kevmc
  • 1,284
  • 7
  • 8
0

Please find the details in these links this explains why we need double slash

http://paulirish.com/2010/the-protocol-relative-url/

Double slash at beginning of javascript include

Community
  • 1
  • 1
karthick
  • 11,998
  • 6
  • 56
  • 88