As a web developer, you regularly come across browser bugs, most often trying to work around obscure problems in IE6 and IE7. IE8 has generally been a relief in comparison, working pretty much to spec along with other browsers like Firefox, Opera, Safari and Chrome.

So I was surprised to come across a very odd and annoying bug in IE8 today. Basically a user reported that when trying to view a particular email, the page would just be blank. After being able to repeat the problem on the same email, I narrowed down bit by bit until I had a segment of HTML the replicated it, which came down to:

<!DOCTYPE html>
<SPAN dir=ltr>before
<SPAN dir=rtl><BR></SPAN>

Creating a file with just that contents and opening in IE8 displays completely blank.

If you make any of the following changes, the page will display ok (the “before” and “after” text displays):

  1. Remove the HTML5 doctype
  2. Add any whitespace character after the <BR> tag
  3. Remove the dir=ltr attribute from the first span
  4. Remove the dir=rtl attribute from the second span

Of course we don’t generate HTML like this, but people do receive HTML emails, that just happen to have content like this, and thus the whole page displays as blank! I’m currently working on a fix to work around this.