假设我有一个使用 Google Ads 转换的博客。
而且我拥有该博客的完全控制权。它没有托管在其他地方。
我是否可以检测向我的读者展示的广告内容?例如,如果显示关键字 Quora
,我想删除广告。
我试过这个: How to get the body's content of an iframe in Javascript?
但我无法获取 HTML。
最佳答案
Is it possible for me to detect the content of the ads that's been displayed to my readers?
这是不可能的,因为 Cross-origin resource sharing (CORS) rules :
Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources on a web page to be requested from another domain outside the domain from which the first resource was served. A web page may freely embed cross-origin images, stylesheets, scripts, iframes, and videos. Certain "cross-domain" requests, notably Ajax requests, are forbidden by default by the same-origin security policy.
Read full article in the link above.
Google Adsense 广告将使用不在您的服务器上的 JavaScript 文件创建。
如何屏蔽广告(来自 Google Adsense 支持的回答)
您可以在“广告查看中心”屏蔽广告。引用自官方 Google Adsense support site:
Ad review center overview
The Ad review center is a feature that gives you more transparency and control over the ads that appear on your site. When you enable the Ad review center, you can review individual ads after they're shown and assess whether you want to continue showing them on your pages.
Some important things to know about the Ad review center:
- You can find it on the Allow & block ads page in your AdSense account
- It supports ads of all targeting types (contextual, personalized, and placement)
- You can use its filter and search functions to help you find ads to review and block
- It doesn't support all AdSense products
- You can only block ads at the product level, not on a site-by-site basis
For help getting started with the Ad review center, see our guide to reviewing ads.
你也可以这样做: <强> Block ads by general category: at the site level or at the product level
重要信息:您也可以用您的语言(例如中文)阅读上述链接中的每个内容。您可以在每个页面的底部更改语言。
关于javascript - 是否可以检测我页面的 Google Adsense 内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51923857/