【发布时间】:2021-11-30 14:10:37
【问题描述】:
假设我在台式机上,或者在没有 WhatsApp 应用程序的 Android 上。我按下它,没有任何反应。应该显示一条通知消息,例如“安装 WhatsApp 应用程序!”或类似的东西。我只有这个:
<a href="whatsapp://send?text=text">Click here to share!</a>
我试过这些:
<a href="whatsapp://send/?phone=62812345678&text=test" id="openWA">Send to WhatsApp</a>
<br>
<a href="viber://forward?text=paff" id="openV">Send to Viber</a>
<!-- Auto open on WebView and Firefox -->
<script>
document.querySelector('#openWA').addEventListener('click', function() {
var f = Date.now(),
j = setTimeout(function() {
if (Date.now() - f > 1250)
return;
alert('WA not installed')
}, 1e3);
});
document.querySelector('#openV').addEventListener('click', function() {
var f = Date.now(),
j = setTimeout(function() {
if (Date.now() - f > 1250)
return;
alert('VIBER not installed')
}, 1e3);
});
</script>
但它说“未安装”,无论是否安装。
【问题讨论】:
-
你按什么却什么也没发生?
-
我按那个“点击这里分享!”链接