Internet Explorer 上的 adsense 抛出异常
Exception thrown with adsense on Internet Explorer
我已经在我的 HTML 标签中复制并粘贴了 adsense javascript 代码 google 分发 -
<ins class="adsbygoogle"
style="display:inline-block;width:234px;height:60px"
data-ad-test="on"
data-ad-client="XXXXX"
data-ad-slot="XXXXX"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
[我在此处粘贴代码时用 XXX 替换了实际的 data-ad-client 和 data-ad-slot 值]
它在 Chrome、Firefox、Edge 上运行良好,但在 Internet Explorer 上出现异常。它说“Javascript 运行时错误:无法在 r.crypto.getRandomValues(d) 上获取 属性 'getRandomValues'of undefined or null reference';adsense 脚本中的函数调用。
不知道发生了什么。任何帮助表示赞赏。
您的代码正在模拟旧版本的 IE。
您可以使用此脚本测试最新的加密货币:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Web Cryptography API</title>
</head>
<body>
<script>
var crypto = window.crypto || window.msCrypto;
if (crypto) {
console.log(crypto);
} else {
console.log("Unable to create window.crypto object");
}
</script>
</body>
</html>
您可以在开发者工具中查看您运行的模式:
没能完全解决这个问题,但我设置 visual studio 不理会那个异常,一切正常。最终切换到 DFP,所以如果有人仍然关心,这不再是问题。
我已经在我的 HTML 标签中复制并粘贴了 adsense javascript 代码 google 分发 -
<ins class="adsbygoogle"
style="display:inline-block;width:234px;height:60px"
data-ad-test="on"
data-ad-client="XXXXX"
data-ad-slot="XXXXX"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
[我在此处粘贴代码时用 XXX 替换了实际的 data-ad-client 和 data-ad-slot 值]
它在 Chrome、Firefox、Edge 上运行良好,但在 Internet Explorer 上出现异常。它说“Javascript 运行时错误:无法在 r.crypto.getRandomValues(d) 上获取 属性 'getRandomValues'of undefined or null reference';adsense 脚本中的函数调用。
不知道发生了什么。任何帮助表示赞赏。
您的代码正在模拟旧版本的 IE。
您可以使用此脚本测试最新的加密货币:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Web Cryptography API</title>
</head>
<body>
<script>
var crypto = window.crypto || window.msCrypto;
if (crypto) {
console.log(crypto);
} else {
console.log("Unable to create window.crypto object");
}
</script>
</body>
</html>
您可以在开发者工具中查看您运行的模式:
没能完全解决这个问题,但我设置 visual studio 不理会那个异常,一切正常。最终切换到 DFP,所以如果有人仍然关心,这不再是问题。