Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does `//` in javascript's src attribute do? [duplicate]

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?

like image 380
Don P Avatar asked Mar 13 '13 05:03

Don P


People also ask

What does the src attribute do?

Definition and Usage The src attribute specifies the location (URL) of the external resource.

What is src attribute value?

Attribute ValuesThe URL of the image. Possible values: An absolute URL - points to another web site (like src="http://www.example.com/image.gif") A relative URL - points to a file within a web site (like src="image.

Is src an attribute or property?

Definition and UsageThe src property sets or returns the value of the src attribute of an image. The required src attribute specifies the URL of an image.

What HTML tags have src attribute?

The purpose of the HTML src attribute is to specify a URI for an external file or resource. HTML src attribute supports frame, iframe, img, input and script elements.


1 Answers

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

like image 79
Thilo Avatar answered Nov 15 '22 14:11

Thilo