Remove js file by template or add condition in info file I work on drupal 7, I added all js by info file, work well in whole site. But we want to remove or not load of a specific js in a specific content type page.

I try by template.php of following code

function mytheme_preprocess_page(&amp;$vars) {
  if (isset($vars['node']-&gt;type) &amp;&amp; !empty($vars['node']-&gt;type) &amp;&amp; ($vars['node']-&gt;type == 'my_content_type')) {
    $js_path = drupal_get_path('theme', 'mytheme') . "/js/xyz.js";
      unset($vars[$js_path]);
  }
}


but load  xyz.js. How to remove of this js file.
You can use hook_js_alter()

Perform necessary alterations to the JavaScript before it is presented on the page.
Parameters
$javascript: An array of all JavaScript being presented on the page.

Then you should be able to use menu_get_object() to load the node type and unset the js file in the $javascript array.
function MYTHEME_js_alter($javascript) {
  $node = menu_get_object();
  if ($node-&gt;type == 'node_type) {
    unset($javascript['path/to/script.js']);
  }
}

Note: I haven't tested this or checked syntax, let me know if it doesn't work and I will test.