简体   繁体   English

仅当设备为android时,才能显示弹出窗口?

[英]How can I make a popup show up only if the device is android?

I am trying to make a popup appear only if the person that traveled on to the website is using an android device. 我试图使弹出窗口仅在访问该网站的人正在使用android设备时显示。 I have seen this done on other websites but I can't seem to figure out how to do this. 我已经在其他网站上看到了此操作,但似乎无法弄清楚该如何执行。 I am attaching a screenshot of what I am wanting to do. 我附上我想做的屏幕截图。

在此处输入图片说明

Please if anyone can please help me with this I would really appreciate it. 如果有人可以请帮助我,我将非常感激。

You can check the user agent and if it is an android device, call your code to display a pop up like this: 您可以检查用户代理,如果它是android设备,则调用您的代码以显示如下所示的弹出窗口:

var ua = navigator.userAgent.toLowerCase();
var isAndroid = ua.indexOf("android") > -1; 
if(isAndroid) {
    // Call your popup code here
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM