문제

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.

도움이 되었습니까?

해결책

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/...

다른 팁

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top