Title: Script blocker not working
Last modified: January 16, 2024

---

# Script blocker not working

 *  Resolved [andreumomi](https://wordpress.org/support/users/andreumomi/)
 * (@andreumomi)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/script-blocker-not-working/)
 * Hi I’m having issues trying to block the following javascript code for Adsterra
   ads (I tried adding the code with and without the <script></script> tags):
 *     ```wp-block-code
       <script>document.write(atob("PHNjcmlwdCB0eXBlPSd0ZXh0L2phdmFzY3JpcHQnIHNyYz0nLy9vdmVybG9hZG1hdHVyZXNwYW5uZXIuY29tLzE3L2JjLzZjLzE3YmM2YzFjMjkyOWM3ZDYxZjAzMmVkNTI1MjcyNWExLmpzJz48L3NjcmlwdD4="));</script>
       ```
   
 * The error states document.write can be a form of eval

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [andreumomi](https://wordpress.org/support/users/andreumomi/)
 * (@andreumomi)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/script-blocker-not-working/#post-17346376)
 * PS: When I add the script without the script tags, **if I accept cookies the 
   page remains blank** (its not a caching issue as I tried loading from other devices,
   clearing browser data and incognito modes)
    -  This reply was modified 2 years, 4 months ago by [andreumomi](https://wordpress.org/support/users/andreumomi/).
 *  Plugin Contributor [Jarno Vos](https://wordpress.org/support/users/jarnovos/)
 * (@jarnovos)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/script-blocker-not-working/#post-17346498)
 * Hi [@andreumomi](https://wordpress.org/support/users/andreumomi/),
 * That’s because this script uses **document.write**, and if that’s invoked after
   the initial page parsing is done, it clears the entire document (hence the blank
   page).
 * If you’re allowed to modify their script, you could instead create a new script
   element and set it’s **src** attribute to the URL as extracted from the base64
   encoded string.
 * Here’s my example, which should work when added to the Script Center. But please
   note that this is merely an example of how you could do it, as I don’t know the
   specifics regarding Adsterra and whether you’re allowed to make such modifications.
 * [adsterra-example-modification.js](https://gist.github.com/jarno-vos/bbc749948d80b8fd2edbd245ff864d00)
 * Kind regards, Jarno

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Script blocker not working’ is closed to new replies.

 * ![](https://ps.w.org/complianz-gdpr/assets/icon-256x256.png?rev=2881064)
 * [Complianz - GDPR/CCPA Cookie Consent](https://wordpress.org/plugins/complianz-gdpr/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/complianz-gdpr/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/complianz-gdpr/)
 * [Active Topics](https://wordpress.org/support/plugin/complianz-gdpr/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/complianz-gdpr/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/complianz-gdpr/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Jarno Vos](https://wordpress.org/support/users/jarnovos/)
 * Last activity: [2 years, 4 months ago](https://wordpress.org/support/topic/script-blocker-not-working/#post-17346498)
 * Status: resolved