I wanted to unset some javascripts since they does nothing but conflict on my custom JS in my mobile theme.
What I did:
// Load all js scripts
$scripts = drupal_add_js();
// Unset all unnecessary scripts
unset($scripts['module']['sites/all/modules/ajax/ajax.js']);
unset($scripts['module']['sites/all/modules/contribs/mollom/mollom.js']);
unset($scripts['module']['sites/all/modules/contribs/views_slideshow/js/jquery.cycle.all.min.js']);
unset($scripts['module']['sites/all/modules/contribs/views_slideshow/contrib/views_slideshow_singleframe/views_slideshow.js']);
unset($scripts['module']['sites/all/modules/contribs/views_slideshow/contrib/views_slideshow_thumbnailhover/views_slideshow.js']);
unset($scripts['module']['sites/all/modules/quicktabs/js/quicktabs.js']);
unset($scripts['module']['sites/all/modules/panels/js/panels.js']);
unset($scripts['module']['sites/all/modules/tipsy/javascripts/jquery.tipsy.js']);
unset($scripts['module']['sites/all/modules/tipsy/javascripts/tipsy.js']);
unset($scripts['module']['sites/all/modules/boxes/boxes.js']);
// Recreate the template variables
$vars['scripts'] = drupal_get_js('header', $scripts);
But the above code is not working in preprocess_page
which I think it really works in the first place, it's just that the original initialization of $scripts in page.tpl.php
loads after the preprocess_page
alteration.
Anyone of have an idea?