Recently I have had a number of clients and others ask me why, when im coding, I link to things as //website.com and not http://website.com.

It’s a good question and when I first came across it myself I put it down as a mistake on the part of the developer and dismissed it, but then I learnt. Through web applications there are certain pages; like registration and login pages, which require the use of https for security reasons. If you were to then load a css or js script which was hosted at http://website.com/script the green padlock would not be displayed in the browser. So rather than having to have a separate set of urls which have https:// or even using a php function to determine you can just set the start of a url to // missing off http: or https:.

Example, if you are wanting to include jQuery into your website, you can use the google hosted source as shown below: