Page 1 of 1

missing http:

Posted: Sun Apr 20, 2014 6:03 am
by roedygr
Google AdSense asks you to include some JavaScipt on your web page that includes this:

src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"

It works fine and it verifies fine. But I would have thought it should be:

src="http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"

Re: missing http:

Posted: Sun Apr 20, 2014 7:14 am
by Albert Wiersch
Hello,

There's nothing wrong with that. It will use http or https depending on what the current/base URL is using. If you specify a protocol there (instead of starting the URL with a double slash), like http, then it will use http, but if it's called from an https page it will still use http when you probably want https, so starting the URL with a double slash avoids this problem.

Here is more info:
Is there any downside for using a leading double slash to inherit the protocol in a URL? i.e. src=“//domain.com”