Skip to main content

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_js

nginx

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 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.
Is deterministic_js enabled by default?
No. deterministic_js 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 deterministic_js on Apache and nginx?
Add ModPagespeedEnableFilters deterministic_js on Apache or pagespeed EnableFilters deterministic_js; on nginx. On IIS, add pagespeed EnableFilters deterministic_js to pagespeed.config.

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

Search