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