2

It seems like the browser conditionals:

  drupal_add_js(drupal_get_path('module', 'cufon') . '/js/cufon-drupal.js',
 array('group' => JS_THEME, 'browsers' => array('IE' => 'gte IE 9', '!IE' => TRUE), 
'weight' => 999, 'preprocess' => FALSE));

included in template.php (or a module) are not working due to the fact browsers option is supported for drupal_add_css() but not for drupal_add_js().

Can one state a not-hackish/patchy solution to exclude this file cufon-drupal.js on older browsers?

A solution like

<!--[if gte IE 9]>
<script src='<?php drupal_add_js(drupal_get_path('module', 'cufon') . '/js/cufon-drupal.js'); ?>'>
</script><![endif]-->

in html.tpl.php is not working.

1
  • 1
    That second snippet doesn't need the drupal_add_js without it, would work Feb 2, 2013 at 21:15

1 Answer 1

-1

Seems like there is a non-drupal solution:

if(jQuery.browser.version.substring(0, 2) != "8.") { alert("not ie8"); }

It is not very handy as I have to paste inside the brackets the content of cufon-drupal.js content.

1
  • 6
    Rather than relying on user agent strings (which are inherently unreliable) it might be better to do this using feature detection/IE conditional comments. Have a look at this post for some ideas
    – Clive
    Mar 26, 2012 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.