When AdBlock is enabled I got the following errors:
AddThis: Uncaught Error: Must pass a string which will eval to a
globally accessible object where callbacks will be stored
MathJax: Uncaught EvalError: Refused to evaluate a string as
JavaScript because 'unsafe-eval' is not an allowed source of script
in the following Content Security Policy directive: "script-src
'self' * 'unsafe-inline'".
When AdBlock is disabled, everything works fine.
The problem appeared a couple of weeks ago.
Even when AdBlock is enabled everything works fine on sites that use MathJax: https://www.mathjax.org and https://math.stackexchange.com/
Possibly, something has changed and I need to change the code properly. How?
Thanks in advance.
Both errors refer to the same Content Security Policy (CSP) issue which is that unsafe eval()
calls are disallowed. Ad blockers, such as AdBlock and Adblock Plus, have recently started using CSPs for cases where traditional techniques are insufficient (see Adblock Plus filter options).
I was only able to reproduce it on emathhelp.net. There I was able to find the filter ||emathhelp.net^$csp=script-src 'self' * 'unsafe-inline'
to be responsible for this which was added to the EasyList ad blocking list on May 15. In Adblock Plus you can find such filters by following these steps:
You can reach out to EasyList (GitHub, forum, website) to find out why they added a particular filter. They should also be able to help you restore any functionality that's broken.