0

我使用以下代码:

if (navigator.platform == 'iPad' || navigator.platform == 'iPad Simulator' || navigator.platform == 'iPhone' || navigator.platform == 'iPhone Simulator' && window.navigator.standalone === false) {
window.alert("We've detected you're on iOS. Did you know that you can put us on your home screen? Tap the share icon, then tap 'Add to homescreen'.");

}

为了提醒他们,有一个可用的独立选项,但它不起作用......奇怪的是,我只有在应用程序处于独立模式时才会得到它。我究竟做错了什么?

编辑:我实际上发现我在函数之外做代码。我以为这样就可以了,可惜不是。

4

0 回答 0