Page 1 of 1

Putting a protocol in the url is not necessary

Posted: Fri Aug 17, 2007 11:34 am
by Luke
So, I was in a predicament recently where I needed to request a secure url if I was on a secure page and a non-secure url otherwise. Unfortunately, this was on a remote server so I needed to use a protocol, or so I thought (I couldn't just do something like this/that/myfile.js). So, I tried just not putting a protocal, and voila! It just used whatever protocol the current page was using. This is very cool, but I just want to make sure there is no downside to this. Anything anybody knows of that is wrong with doing this?

Code: Select all

<script type="text/javascript" src="//www.example.com/scripts/some-script.js"></script>

Posted: Fri Aug 17, 2007 12:49 pm
by miro_igov
Wow cool, i was doing PHP test for SSL when i need to use external includes.

Does this work on all browsers?