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).
- 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
- options for code placement:
- preprocessed (aggregated)
- file (non-preprocessed)
- 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
<noscript> tags inside the page content as well.
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.
- Maintenance status: Minimally maintained
- Development status: Maintenance fixes only
- Reported installs: 9,276 sites currently report using this module. View usage statistics.
- Downloads: 60,524
- Last modified: 2 December 2014
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.