How to prevent google ads from displaying console messages or uncaught errors

617 views Asked by At

Is there a way to block the google ads scripts from displaying any console messages?

(also in their third party script that may run)

My concern is that sometimes I see messages such as the one below loading large object and uncaught errors that may end up slowing down the client

enter image description here

enter image description here

Locally it really goes out of control:

enter image description here

1

There are 1 answers

0
Yovav On BEST ANSWER

This is not perfect, but it seems to be very effective in my case (all pages are SSL) and also prevent SSL mixed mode messages caused by google ads third party plugin scripts...

<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests; object-src 'none'">

Content-Security-Policy is critical to prevent mixed content errors (too many errors can show a "connection not secure" by the browser and memory leaks) https://blog.cloudflare.com/fixing-the-mixed-content-problem-with-automatic-https-rewrites and How does Content Security Policy work?