filter · JavaScript filters
Deterministic JavaScript (deterministic_js)
- Category:
- JavaScript
- CoreFilters:
- No
- OptimizeForBandwidth:
- No
- Risk:
- Dangerous set
Injects a script that makes Date and Math.random return deterministic values, so two loads of a page produce the same output and can be compared byte for byte. For measurement and regression testing only; it changes the behavior of every script on the page. 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 deterministic_js 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 deterministic_jsnginx
pagespeed EnableFilters deterministic_js;IIS (pagespeed.config)
pagespeed EnableFilters deterministic_js
Scoping, ForbidFilters and the thresholds filters read:
Choosing filters
.
Frequently asked questions
- What does the deterministic_js filter do?
- Injects a script that makes
DateandMath.randomreturn deterministic values, so two loads of a page produce the same output and can be compared byte for byte. For measurement and regression testing only; it changes the behavior of every script on the page. In the dangerous set. - Is deterministic_js enabled by default?
- No.
deterministic_jsis in the dangerous set, which no RewriteLevel enables, not evenAllFilters. Enable it by name, for testing and measurement only. - How do I enable deterministic_js on Apache and nginx?
- Add
ModPagespeedEnableFilters deterministic_json Apache orpagespeed EnableFilters deterministic_js;on nginx. On IIS, addpagespeed EnableFilters deterministic_jsto 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 deterministic_js entry on JavaScript filters. Every filter in one table: PageSpeed filters.