Google Trusted Stores Test Drive 未在 IE11 中显示

Google Trusted Stores Test Drive not displaying in IE11

我正在与客户合作,帮助他们在他们的网站上实施 Google Trusted Stores。该代码已在 Chrome 和 Firefox 中验证,但不会在 IE 中验证。

原因是实际的“validator”元素没有出现。所以没有错误可看或任何继续,它只是没有显示。

Google 的文档仅说明如果代码未显示,则徽章代码重复或丢失。然而,情况并非如此,因为它甚至没有出现在没有代码但没有脚本的网站版本上。

主页上显示的与脚本相关的代码如下:

<script type="text/javascript">
var gts = gts || [];

gts.push(["id", "STORE_ID_HERE"]); // Note: value removed for privacy
gts.push(["badge_position", "BOTTOM_LEFT"]);
gts.push(["locale", "en_US"]);

// This is a "platform hack" to support the cart they're on
// insures that the ProductID value is only transmitted on the right pages
if( $('body').hasClass('category-page-type') || $('body').hasClass('search-page') || $('body').hasClass('recommended-products-page') || $('body').hasClass('product-page-type') )
{
    gts.push(["google_base_offer_id", currentProductId]); // loads variable from input on product pages
}

gts.push(["google_base_subaccount_id", "ID_HERE"]); // Also removed for privacy
gts.push(["google_base_country", "US"]);
gts.push(["google_base_language", "en"]);

(function() {
var gts = document.createElement("script");
gts.type = "text/javascript";
gts.async = true;
gts.src = "https://www.googlecommerce.com/trustedstores/api/js";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(gts, s);
})();
</script>

此代码在 Firefox/Chrome 中有效,但在 IE11 中无效(仅测试版本,每个 Google 需要支持 9+)。

我也在一个动态生成的文件中发现了这个错误(也在 IE11 控制台中),但我真的不确定为什么:

Failed to open http://www.googlecommerce.com/trustedstores/s/tm2?id=17172&jsv=sDipv1xMSq4&hl=en_US&xpc={"cn"%3A"q9GW00NhHi"%2C"tp"%3Anull%2C"osh"%3Anull%2C"ppu"%3A"http%3A%2F%2Fwww.greenelectricalsupply.com%2Frobots.txt"%2C"lpu"%3A"http%3A%2F%2Fwww.googlecommerce.com%2Frobots.txt"}

控制台错误显示为跨源限制,但出于某种原因,这对我来说似乎不正确。

这个link导致验证器出现:http://bit.ly/15LbcaL

您会注意到它出现在 Chrome/Firefox 中,但不会出现在 IE 中(尚未测试 9/10,但 11 肯定不起作用)。我实际上已经联系了 Google,但我还没有收到回复。感谢任何帮助。

更新

Google 表示问题是 Window.prototype 未定义,但我对这个答案不太有信心,因为验证器栏(和有问题的脚本)在其他浏览器中工作正常,只是不是这个。

不确定你是否解决了这个问题,但我遇到了同样的问题并向 Google 寻求帮助并建议这样做:

我在头部部分有这个元代码:

<meta http-equiv="X-UA-Compatible" content="IE=8" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />

这些 IE7 和 IE8 元数据阻止了徽章加载。

然后他们说只添加这个:

<meta http-equiv="X-UA-Compatible" content="IE=Edge">

它非常简单并且对我有用。 希望它能帮助你解决问题,或者也能帮助别人。

问题实际上出在 Google 的脚本上。一旦他们最终更正了代码,代码就可以正常工作。

谢谢!