Junkie Tips: Using Protocol Relative URLs

If you’ve ever created a site that need https, then you have probably ran into this issue. In IE, you get a warning about some of the content not being secure. This warning is caused because you are serving some of your media, like images and CSS from a non https domain. A really quick fix for this is to just use // instead of http:// or https://. Believe it or not, this works and is a totally valid way to get around the issue.

Here’s a quick little example

<link href="//css/style.css" rel="stylesheet" type="text/css" />

or …

<img src="//path/to/the/image.jpg" alt="my image" />

S

h

a

r

e

  • Share this post on Delicious
  • StumbleUpon this post
  • Share this post on Digg
  • Tweet about this post
  • Share this post on Mixx
  • Share this post on Technorati
  • Share this post on Facebook
  • Share this post on NewsVine
  • Share this post on Reddit
  • Share this post on Google
  • Share this post on LinkedIn

About the author

Nate Smith has written 21 articles for Box Model Junkie

I am a 28 year old designer / developer from Peoria, IL who is very into PHP, WordPress, Django and jQuery. I have a huge passion for the web and love learning new things. You can follow me on twitter @imns81

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>

About

Box Model Junkie is a site addicted to Front-end / UI development. We focus on tutorial relating to JavaScript frameworks, CSS3 and HTML5.