filter · JavaScript filters
Strip scripts (strip_scripts)
- Category:
- JavaScript
- CoreFilters:
- No
- OptimizeForBandwidth:
- No
- Risk:
- Dangerous set
Removes every <script> element from the page, the more drastic variant of disable_javascript for measuring the no-script baseline. For measurement only. In the dangerous set.
When to use it
- In the dangerous set: no RewriteLevel enables it, not even
AllFilters. It exists for testing and measurement, not for production traffic. - Risk rating on these docs: Dangerous.
Risks
The
JavaScript filters
page lists no specific risks for this filter.
If a page misbehaves with it, DisableFilters strip_scripts turns it off for
the scope you set it in.
Configuration
Enable it in the module configuration, at server, virtual-host or location scope:
Apache
ModPagespeedEnableFilters strip_scriptsnginx
pagespeed EnableFilters strip_scripts;IIS (pagespeed.config)
pagespeed EnableFilters strip_scripts
Scoping, ForbidFilters and the thresholds filters read:
Choosing filters
.
Frequently asked questions
- What does the strip_scripts filter do?
- Removes every
<script>element from the page, the more drastic variant ofdisable_javascriptfor measuring the no-script baseline. For measurement only. In the dangerous set. - Is strip_scripts enabled by default?
- No.
strip_scriptsis in the dangerous set, which no RewriteLevel enables, not evenAllFilters. Enable it by name, for testing and measurement only. - How do I enable strip_scripts on Apache and nginx?
- Add
ModPagespeedEnableFilters strip_scriptson Apache orpagespeed EnableFilters strip_scripts;on nginx. On IIS, addpagespeed EnableFilters strip_scriptsto pagespeed.config.
Related filters
- combine_javascript — Combine JavaScript
- defer_javascript — Defer JavaScript
- extend_cache_scripts — Extend cache for scripts
- include_js_source_maps — Include JS source maps
- inline_javascript — Inline JavaScript
- make_show_ads_async — Async AdSense
- outline_javascript — Outline JavaScript
- rewrite_javascript_external — Minify external JavaScript
This page is drawn from the strip_scripts entry on JavaScript filters. Every filter in one table: PageSpeed filters.