Relative Protocol URL’s – http(s) safe

It’s pretty often that we use and see relative URL’s. They are everywhere. They help maintain portable environments and organization / maintenance of websites. What many may not hear about that often are that URL’s can also have relative protocols. Since IE7, browsers allow you to create a link beginning with a double forward slash “//” that acts as a relative protocol. This ensures that you maintain a single protocol throughout a single session. For example, switching from HTTPS to HTTP in IE7 and IE8, you will get a security warning that is extremely intrusive to a users experience. Take a look at some examples.

  1. <script src="//www.phillihp.com/js/include.js" type="text/javascript" language="JavaScript"></script>
  2. <link rel="stylesheet" href="//www.phillihp.com/css/style.css?ver=5.13" type="text/css" media="all" />
  3. <img src="//www.phillihp.com/images/graphic.png" />

Now there have been issues with browsers, specifically IE6. But it’s safe to say that IE6 can be dropped off, within the past year, especially in the United States, less than 2%. Chinese websites still get a significant IE6 present, but still less than 20%. All-in-all, this Relative Protocol URL is very effective and perfect for cross protocol situations, commonly used in cross-domain situations. Enjoy!

About Phillihp Harmon

I'm Phillihp. My name can be spelled the same way forwards and backwards, so can my posts... if you wish. I'm out here exploring, learning, and sharing what I find. This is more for fun and personal growth, I aim to be as consistent as possible, so check back daily!
This entry was posted in Chrome, Cloud Computing, Firefox, HTML5/CSS3, Internet, Internet Explorer, Microsoft, Safari. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>