Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why we use double slash instead http

I see some web pages that link javascript file to page like this :

<script async="" src="//www.googletagmanager.com/gtm.js"></script>

Why we use double slash ( // ) instead http:// or https:// from beginig absolute url ? what's different ?

like image 453
farzad Avatar asked Dec 18 '16 00:12

farzad


People also ask

Why is there a double slash after HTTP?

URLs with a double slash in the path can be generated by content management systems, plugins or broken HTML, and are often caused by issues with relative linking and/or the base URL. You may require developer help to track down the origin of the issue and resolve it.

What do 2 slashes mean?

Particularly as a double slash in written work usually means "new line here".

Is double slash valid in URL?

Google's John Mueller said it isn't recommended to use // - double slashes - in your URL path. He said generally if browsers can handle it so can Googlebot.

Why is there a colon after HTTP?

Addresses. Internet URLs use the colon to separate the protocol (such as http: ) from the hostname or IP address.


1 Answers

the protocol will be inherited from whichever page you're on. If your site can be on different protocols - http on the homepage, https on account pages, for example - then you won't have to worry about potentially loading "insecure content."

like image 63
hellatan Avatar answered Oct 07 '22 13:10

hellatan