missing http:

For technical support for all editions of CSS HTML Validator. Includes bug reports.
Post Reply
User avatar
roedygr
Rank V - Professional
Rank V - Professional
Posts: 370
Joined: Fri Feb 17, 2006 5:22 am
Location: Victoria BC Canada
Contact:

missing http:

Post by roedygr » Sun Apr 20, 2014 6:03 am

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"

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3445
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: missing http:

Post by Albert Wiersch » Sun Apr 20, 2014 7:14 am

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”
Image
Albert Wiersch

Post Reply