Question

I know that HTTP is hyper text transfer protocol, and I know that's how (along with HTTPS) one accesses a website. However, what does just a // do? For instance, to access Google's copy of jQuery, one would use the url //ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js, as opposed to http://....

What exactly is the difference? What does just // indicate?

Thanks.

Was it helpful?

Solution

By saying on // it means use whatever protocol (IE: http vs https) your user is currently hittin for that resource.

So you don't have to worry about dealing with http: vs https: management yourself.

Avoiding potential browser security warnings. It would be good practice to stick with this approach.

For example: If your user is accessing http://yourdomain/ that script file would automatically be treated as http://ajax.googleapis.com/...

OTHER TIPS

if your current request is http

//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js 

will be treated as

http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js

if your current request is https

//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js 

will be treated as

 https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top