Versions of Backdrop prior to Backdrop 1.27.0 included the ability to add style sheets and JavaScript files that targeted certain versions of Internet Explorer (versions 5 - 10). As Internet Explorer is discontinued by Microsoft (replaced by the Edge browser), and conditional comments no longer work on any modern browser, support for conditional comments has been removed from Backdrop.

For example, the following code could be used to add a stylesheet for Internet Explorer 6 only:

backdrop_add_css(backdrop_get_path('module', 'mymodule') . '/css/ie.css', array(
  'browsers' => array('IE' => 'lt IE 7', '!IE' => FALSE),
);

This was also possible to target IE browsers within hook_library_info() such as this:

$libraries['html5shiv'] = array(
  'title' => 'html5shiv',
  'website' => 'http://code.google.com/p/html5shiv/',
  'version' => '3.7.3',
  'js' => array(
    'core/misc/html5.js' => array(
      'group' => JS_LIBRARY,
      'weight' => -21,
      'browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE),
    ),
  ),
);

And also possible to specify browsers as part of the #attached property when attaching CSS or JS:

$form['element']['#attached'] = array(
  'css' => array(
    backdrop_get_path('module', 'mymodule') . '/css/ie.css' => array(
      'browsers' => array('IE' => 'lt IE 7', '!IE' => FALSE),
    ),
  ),
);

After Backdrop 1.27.0, any conditional "browsers" properties now act in the following way:

  • Any value specified in the "browsers" sub-key "IE" is completely ignored.
  • If the "browsers" sub-key "!IE" is TRUE, the file is added to the page normally.
  • If the "browsers" sub-key "!IE" is FALSE, the file is entirely excluded from output.

Existing code that uses "browsers" should remove any IE-specific CSS and JS, and then remove use of the "browsers" property.

Introduced in branch: 
1.x
Introduced in version: 
1.27.0
Impacts: 
Module developers
Theme developers