Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do protocol relative urls work cross-platform?

Tags:

html

http

uri

I often use the // relative URI hack. Example:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>

Mostly because of this post: Is it valid to replace http:// with // in a <script src="http://...">?.

However, a guy I am working with on a project says this doesn't work on Mac (Chrome, Firefox, and Safari) or iDevices.

Not having a Mac or said devices, I can't verify it, and it works fine on Windows. Can anyone confirm this?

like image 331
Peter C Avatar asked Oct 11 '22 05:10

Peter C


1 Answers

I can't test it as I don't have a Mac, but there is no reason to believe that mac browsers do not follow RFC 3986 Section 4.2 when resolving URLs.

Your friend probably meant something else.

like image 196
Pekka Avatar answered Oct 14 '22 00:10

Pekka