It looks like IE6 and IE7 don't have Trident in their user agent string, so that wouldn't be a consistent identifier to look for.