我有一个代码,目前将所有ipad访问者带到website.com,所有剩余访问者访问website.net
现在我想编辑代码,并将ipad访问者分配的功能从window.open url更改为"通过whatsapp"分享website.com网址。动作。
你能帮我解决一下这段话吗?
<script>function Share()
{ if( /iPad/i.test(navigator.userAgent) || /iPhone/i.test(navigator.userAgent) ) { window.open('http://website.com/'); }
else{ window.open('http://website.net/'); } } </script>
<div class="whatsapp_button"><img src="../images/whatsapp.png" onclick="Share()"></div>
我需要集成以下代码以替换上面的代码(window.open('http://website.com/');
)
这一个:
<a href="whatsapp://send?text=Please visit website.com" data-action="share/whatsapp/share"></a></body>
答案 0 :(得分:0)
<script>
function Share(){
if( /iPod/i.test(navigator.userAgent) || /iPhone/i.test(navigator.userAgent) ) {
window.open('http://website.com');
}else{
document.write('<a href="https://api.whatsapp.com/send?phone=40753023777&text=Please visit Website.com" data-action="share/whatsapp/share" class="offer1"></a>');
}
}
</script>