Shopify 购买按钮未在手机上显示
Shopify buy buttons not showing on mobile
我的网站上有一些 shopify 购买按钮。它们在桌面浏览器上显示良好 - 网站响应迅速,按钮显示在桌面浏览器的所有视口查询中。
在移动设备上查看网站时没有购买按钮。我认为这可能是一个跨源问题,所以我在本地托管了 shopify javascript 文件,我得到了相同的行为。
我已经尝试了所有不同版本的“立即购买”按钮,但我得到了相同的行为。
我在手机上看不到购买按钮是什么原因?站点是 www.redlamp.com.au/myriad/shopify2.html
shopify 代码有错误buy-button-storefront.min.js:7 TypeError: Failed to execute 'fetch' on 'Window': Invalid value(…)
好像是fetch is not available on your Android device see more info here。
尝试在 运行 Shopify 代码之前添加像 that one 这样的 polyfill。
或者他们这边真的有错误。您可以在 their GitHub repo
上解决问题
我找到了罪魁祸首 - 我用自己的基本 add/remove class 函数扩展了对象。删除以下代码修复了问题:
Object.prototype.addClass = function(clas) {
if (this.classList)
this.classList.add(clas);
else
this.className += ' ' + clas;
}
Object.prototype.remClass = function(clas) {
if (this.classList)
this.classList.remove(clas);
else
return;
}
谢谢!
我的网站上有一些 shopify 购买按钮。它们在桌面浏览器上显示良好 - 网站响应迅速,按钮显示在桌面浏览器的所有视口查询中。
在移动设备上查看网站时没有购买按钮。我认为这可能是一个跨源问题,所以我在本地托管了 shopify javascript 文件,我得到了相同的行为。
我已经尝试了所有不同版本的“立即购买”按钮,但我得到了相同的行为。
我在手机上看不到购买按钮是什么原因?站点是 www.redlamp.com.au/myriad/shopify2.html
shopify 代码有错误buy-button-storefront.min.js:7 TypeError: Failed to execute 'fetch' on 'Window': Invalid value(…)
好像是fetch is not available on your Android device see more info here。
尝试在 运行 Shopify 代码之前添加像 that one 这样的 polyfill。
或者他们这边真的有错误。您可以在 their GitHub repo
上解决问题我找到了罪魁祸首 - 我用自己的基本 add/remove class 函数扩展了对象。删除以下代码修复了问题:
Object.prototype.addClass = function(clas) {
if (this.classList)
this.classList.add(clas);
else
this.className += ' ' + clas;
}
Object.prototype.remClass = function(clas) {
if (this.classList)
this.classList.remove(clas);
else
return;
}
谢谢!