I want to add an external file to the header. To that affect I copied what others have done and used drupal_add_js();
:
drupal_add_js('somefile.js', [
'type' => 'external',
'scope' => 'header',
'defer' => TRUE,
]);
But the link still appears in the footer. Of course I've cleared cache and theme registry, but no changes.
How can I add the file to <head>
?
header
defined in its info fileregions[header] = Header
grep -rn 'somefile' /var/www/html/my-drupal-site/
to see if anybody else is trying to include it.html.tpl.php
? If so, you may check where it is printing the$scripts
variable (<?php print $scripts; ?>
). Is it located within your template's header, or at the bottom of your file?hook_js_alter()
implementation? api.drupal.org/api/drupal/modules%21system%21system.api.php/…