CSS Background broken in ie9 on dev box (no ssl certificate).
Well, this morning’s lesson wasn’t too painfiul, thanks to Paul Irish’s article on The Protocol-relative URL. In short, I was trying to view a page on our staging server (my local dev has a self-signed certificate) which didn’t have an ssl certificate. Everything worked fine using the https:// protocol, except in ie9 (specifically), where a background image was not showing up.
The image in question was called through a css statement using a relative URL:
background-image: url(/path/to/background.gif);
which, in the normal html world works fine. However, ie9 seems to be picky (stupid) and thinks it should be downloaded using regular http:// protocol. Not clear on why, but the bottom line is that the following works fine in all browsers (note the extra hash mark).
background-image: url(//path/to/background.gif);
fwiw,
– Pete