How to block google ads from injecting JavaScript

别说谁变了你拦得住时间么 提交于 2019-12-08 04:10:56

问题


Some google ads start injecting JavaScript and poping ads all over the screen

How can I block these random scripts that are injected through google ads?


回答1:


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?



来源:https://stackoverflow.com/questions/44585680/how-to-block-google-ads-from-injecting-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!