Preface: It's quite possible that I'm not the first to discover this. But I did come up with this idea without finding a prior example of it before.
An aside, I'm fully aware that IE's JScript engine contains a method at targeting IE using JScripts conditional comments, but I've never been too impressed with these because they only allow me to target JScript versions, and not individual IE builds.
Enter: CSS Conditional Comments
Being a seasoned CSS veteran of the web standards wars (ok kidding) I turned to what I know best...CSS Conditional Comments.
I've seen most people use Conditional Comments (CC) to target IE in CSS hacks, but I seldom see people serve IE anything other than stylesheets with this method. I think a few people forget that you can actually wrap CCs around any valid HTML elements (see PositionIsEverything for a sweet method of doing this).
CCs are pretty simple to use. They're pretty much HTML comment blocks that only IE recognizes. The example below will only show up to IE6 users.
<!--[if IE 6]> Hello IE6! <![endif]-->
We can also target previous browser releases with the following:
<!--[if lte IE 6]> Hello IE6! <![endif]-->
We could also target all versions of IE with the following code:
There are a few drawbacks to this method. First, the conditional comment code will all have to appear inline on each page its used. I suppose one could create an external .js file and wrap it with the conditional comments. Second, we'll have to account for all the versions of IE we want to target or at least use LTE/GTE to target IE6/IE7 and its previous versions.