问题描述
我的页面没有错误,没有消息,没有问题。我关闭了广告拦截器。我添加了来自Google的自动adsense代码:
让Google为您投放广告 在您的网站上添加一段代码,Google就会自动在所有最佳位置展示广告。
广告没有展示。
控制台说现在有5个错误。
我的html是骨骼。没有js,没有CSS。我添加的Google javascript代码段有什么问题?
谢谢
亚历克斯
以下,添加google adsense代码段时出现了新错误:
zrt_lookup.html?fsb=1:17 [Violation] Avoid using document.write(). https://developers.google.com/web/updates/2016/08/removing-document-write
$a @ zrt_lookup.html?fsb=1:17
cb @ zrt_lookup.html?fsb=1:19
(anonymous) @ zrt_lookup.html?fsb=1:20
(anonymous) @ zrt_lookup.html?fsb=1:20
zrt_lookup.html?fsb=1:17 [Violation] Avoid using document.write(). https://developers.google.com/web/updates/2016/08/removing-document-write
$a @ zrt_lookup.html?fsb=1:17
cb @ zrt_lookup.html?fsb=1:19
(anonymous) @ zrt_lookup.html?fsb=1:20
(anonymous) @ zrt_lookup.html?fsb=1:20
zrt_lookup.html?fsb=1:21 [Violation] Avoid using document.write(). https://developers.google.com/web/updates/2016/08/removing-document-write
(anonymous) @ zrt_lookup.html?fsb=1:21
VM161541:1 [Violation] Avoid using document.write(). https://developers.google.com/web/updates/2016/08/removing-document-write
W @ VM161541:1
VM161569:1 [Violation] Avoid using document.write(). https://developers.google.com/web/updates/2016/08/removing-document-write
W @ VM161569:1
abg_lite_fy2019.js:8 [Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
E @ abg_lite_fy2019.js:8
rb @ abg_lite_fy2019.js:27
xb @ abg_lite_fy2019.js:30
Gb @ abg_lite_fy2019.js:33
yb @ abg_lite_fy2019.js:32
zb @ abg_lite_fy2019.js:32
Hb @ abg_lite_fy2019.js:33
(anonymous) @ VM161574:1
(anonymous) @ zrt_lookup.html?fsb=1:21
解决方法
这些消息不是错误,而是警告。 AdSense广告使用了一些旧式浏览器API,例如document.write()
和非被动事件侦听器,虽然不建议使用,但它们仍然可以使用。