How to conditionally load javascript file on view page I'm trying to load some theme javascript only to one view(multiple displays). I've tried to use the views preprocessor funciton, but maybe I'm doing it wrong:

function themename_preprocess_views_view__viewname__page(&amp;$variables){
  this doesn't run on view page;
}


I've also tried it with the function name themename_views_view(). There's not much documentation on this.
This should work:

/**
 * Implements template_preprocess_views_view().
 */
function themename_preprocess_views_view(&amp;$vars) {
  $view = $vars['view'];
  if ($view-&gt;name == 'view_name') {
    // Standardize the output for rows.
    drupal_add_js(drupal_get_path('theme', 'themename') . '/js/js_name.min.js', array('scope' =&gt; 'footer'));
  }
}