Enqueue script only for IE

WordPress has a $is_IE global variable:

global $is_IE;
if($is_IE) enqueue_script(...);

Personally I prefer the IE conditional comments. Other browsers ignore them anyway, so there’s no reason to use PHP for browser detection.

You might also want to consider using 8 bit alpha PNG images instead of 24 bit PNGs, which don’t need any javascript fix in IE, and in most cases they will look the same as a 24 bit PNG.

Leave a Comment

error code: 523