[theme-reviewers] User Agent Sniffing

Otto otto at ottodestruct.com
Tue Mar 25 00:19:42 UTC 2014

For the specific case of stylesheets, there is a way to have it add the IE
if statements directly. Examine this code from Twenty Twelve:

global $wp_styles;
wp_enqueue_style( 'twentytwelve-ie', get_template_directory_uri() .
'/css/ie.css', array( 'twentytwelve-style' ), '20121010' );
$wp_styles->add_data( 'twentytwelve-ie', 'conditional', 'lt IE 9' );

There's no support for scripts like this yet (I think), but for older IE
versions, this is the simplest way.


On Mon, Mar 24, 2014 at 12:55 PM, Devin Price <devin at wptheming.com> wrote:

> I don't see any guidelines against user agent sniffing, but it seems like
> a bad practice to me especially when there are better methods for checking
> for IE versions.  Also, with the popularity of caching plugins it seems
> like enqueing scripts based on a user agent could cause issues.  Has there
> been a discussion of this in the past?  The theme I'm currently reviewing
> is here: https://themes.trac.wordpress.org/ticket/17401
> Cheers,
> Devin.
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20140324/d2136a11/attachment.html>

More information about the theme-reviewers mailing list