Skip to main content

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_scripts

nginx

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 of disable_javascript for measuring the no-script baseline. For measurement only. In the dangerous set.
Is strip_scripts enabled by default?
No. strip_scripts is in the dangerous set, which no RewriteLevel enables, not even AllFilters. Enable it by name, for testing and measurement only.
How do I enable strip_scripts on Apache and nginx?
Add ModPagespeedEnableFilters strip_scripts on Apache or pagespeed EnableFilters strip_scripts; on nginx. On IIS, add pagespeed EnableFilters strip_scripts to pagespeed.config.

This page is drawn from the strip_scripts entry on JavaScript filters. Every filter in one table: PageSpeed filters.

Search