Protocol-less URLs

by Adactus Ltd 11. August 2011 14:01
When offering HTTPS any content you load from external sources also needs to be loaded over HTTPS as well, otherwise you'll receive errors such as "Only secure content is displayed" and that external CSS, image or JavaScript file will be blocked unless you allow it on each page load. This is often the case with CDN content such as Google's jQuery CDN and jQueryUI etc.
Previously, the only way around this, would be hard code the HTTPS, which forces the HTTPS connection when the site is accessed in HTTP mode as well. But this causes an estimated 3.5% overhead over the standard HTTP, per call. We could use JavaScript to use the appropriate protocol, and the Google Analytics plugin uses this exact technique.
However, there is another way - the protocol-less url way - and it looks like this:
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js">
</script>
This means that the browser works out which protocol it should be using based on the page that loaded it.
It really works nicely, and more info can be seen here:
 

Tags: , , ,

Performance

Comments (2) -

8/16/2011 10:40:55 PM #

Путаны Москвы

When offering HTTPS any content you load from external sources also needs to be loaded over HTTPS as well, otherwise you'll receive errors such as "Only secure content is displayed" and that external CSS, image or JavaScript file will be blocked unless you allow it on each page load.  This is often the case with CDN content such as Google's jQuery CDN and jQueryUI etc.
Previously, the only way around this, would be hard code the HTTPS, which forces the HTTPS connection when the site is accessed in HTTP mode as well.

Путаны Москвы United States | Reply

8/17/2011 1:08:42 PM #

Jimmy Kozner

Im impressed.  I dont think Ive met anyone who knows as much about this subject as you do.  Youre truly well informed and very intelligent.  You wrote something that people could understand and made the subject intriguing for everyone.  Really, great blog youve got here.

Jimmy Kozner United States | Reply

Add comment




  Country flag
biuquote
Loading


About Adactus Ltd

Adactus provides practical and bespoke software development and consulting services for web sites. As a Microsoft partner, Adactus can deliver customised web solutions, mobile development and general bespoke software development services across a wide range of eBusiness and eCommerce needs.  We also provide performance testing services for eCommerce development and other transaction-intensive web solutions.

Month List