function detect(){ var equipmentType = ""; var agent = navigator.userAgent.toLowerCase(); var android = agent.indexOf("android"); var iphone = agent.indexOf("iphone"); var ipad = agent.indexOf("ipad"); if(android != -1){ equipmentType = "android"; } if(iphone != -1 || ipad != -1){ equipmentType = "ios"; } return equipmentType; } ———————————————— 版权声明:本文为CSDN博主「A-fish」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/sally18/article/details/84327745