In a WordPress theme, how do you conditionally include scripts for ie8 and below? This is primarily to apply polyfills for various html5/css3 features. I see that wp has the $is
The best way to do it is enqueue the scripts and then use wp_style_add_data() to put conditional. This method is being used by official themes like twenty thirteen
There is an answer similar to this but he adds extra if in the condition which is wrong.
wp_register_style( 'ie_html5shiv', get_template_directory_uri() . '/js/html5shiv.js' );
wp_enqueue_style( 'ie_html5shiv');
wp_style_add_data( 'ie_html5shiv', 'conditional', 'lt IE 9' );
wp_register_style( 'ie_respond', get_template_directory_uri() . '/js/respond.min.js' );
wp_enqueue_style( 'ie_respond');
wp_style_add_data( 'ie_respond', 'conditional', 'lt IE 9' );