GNU LibreJS --an add-on for GNU IceCat and Mozilla Firefox-- detects and blocks nonfree nontrivial JavaScript while allowing its execution on pages containing code that is either trivial and/or free.

Many websites run nontrivial JavaScript on your computer. Some use it for complex tasks; many use it gratuitously for minor jobs that could be done easily with plain HTML. Sometimes this JavaScript code is malicious. Either way, the JavaScript code is often nonfree. For explanation of the issue, see The JavaScript Trap.

If you care about freedom in your computing, and don't wish to let all and sundry make you run nonfree programs, now you can prevent it by using LibreJS.