Replaced by Asset Injector
The module has been replaced with Asset Injector, please use that instead.
Allows administrators to inject JS into the page output based on configurable rules. It's useful for adding simple JS tweaks without modifying a site's official theme - for example, a 'nighttime' color scheme could be added during certain hours. The JS is added using Drupal's standard drupal_add_js() function and respects page caching, etc.
This module is definitely not a replacement for full-fledged theming, but it provides site administrators with a quick and easy way of tweaking things without diving into full-fledged theme hacking.
The rules provided by JS injector typically are loaded last, even after the theme JS, although another module could override these.
7.x-2.x stable release
This is a complete rewrite of the module to take advantage of the new API's available in both drupal 7 and ctools (this is a new dependency).
New features:
- retains all existing functionality from 7.x-1.x
- new ctools export API integration
- new ctools export UI API integration
- new features integration (you can now export your rules into code)
- code tidy ups including:
- removed legacy css_injector code
- removed D6 hangover code
- utilised new D7 API enhancements
- fully commented
- support for placing the javascript in the header or footer
- options for code placement:
- preprocessed (aggregated)
- file (non-preprocessed)
- inline
- sensible defaults for all of the above
- individual js_injector rules can be disabled (ctools feature)
- code base is now actually smaller - patch is 362 insertions(+), 484 deletions(-)
The most recent stable tag is recommended for production sites, and if you want to experiement with newer features, then 7.x-2.x-dev is for you
7.x-2.x development branch
Thanks to miiimooo #2254951: Support for noscript tag there is now support for adding <noscript> tags inside the page content as well.
8.x-1.x
Yes that's right, there is already a early testing branch for you out there looking to test out Drupal 8 before it's release. This new branch is a complete re-write of the Drupal 7 code. Major changes include:
- Implementing rules as new configuration entities (which means they are stored in YAML and can be deployed with the rest of your site)
- Removal of the ctools dependency
- Removal of the custom database table (YAML only now)
- Objects everywhere
I am keen to hear feedback on this branch, let me know how well the module worked for you on Drupal 8.
Project information
- Project categories: Developer tools
3,242 sites report using this module
- Created by ponsich on , updated
Stable releases for this project are covered by the security advisory policy.
There are currently no supported stable releases.






