To alter the path of a js file included in .info  in some special cases

like if you want a separate main script file on ur site for some special browsers like iphone or mobiles.

do the following in your template.php

Example: If you want a new js file for ipads 'scripts-ipad.js'

function MYTHEME_js_alter(&$js){
if(is_ipad()) // refer to http://anilmaharjan.com.np/index.php/blog/2011/10/to-detect-an-ipad-or-an-iphone-in-php-http_user_agent
        $js['sites/all/themes/MYTHEME/js/scripts.js']['data'] = 'sites/all/themes/MYTHEME/js/scripts-ipad.js';

}

Where MYTHEME will be your theme name.

You can do similar for CSS files too use MYTHEME_css_alter() explained here http://anilmaharjan.com.np/index.php/blog/2011/10/remove-unnecessary-css-from-drupal-website

Comments

comments

Uncategorized

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.