Here is an example of Daniel Wehner's answer. It is assumed that your opinion is called "blog" and your display identifier is "page_1". This code goes into template.php. Remember to clear the template cache after adding new functions to template.php.
/** * Implements hook_preprocess_views_view(). */ function THEMENAME_preprocess_views_view(&$vars) { $view = $vars['view']; // Load the blog.js javascript file when showing the Blog view page display. if ($view->name == 'blog' && $view->current_display == 'page_1') { global $theme; drupal_add_js(drupal_get_path('theme', $theme) . '/js/blog.js', 'theme', 'footer', FALSE, TRUE, FALSE); } }
source share