如何用JS判断是苹果客户端还是安卓客户端:
if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
//alert(navigator.userAgent);
window.location.href ="iPhone.html";
} else if (/(Android)/i.test(navigator.userAgent)) {
//alert(navigator.userAgent);
window.location.href ="Android.html";
} else {
window.location.href ="pc.html";
};
本文介绍了一种使用JavaScript来判断客户端是iOS、Android还是PC的方法。通过检查`navigator.userAgent`属性,可以实现根据不同类型的客户端跳转到不同的页面。
180

被折叠的 条评论
为什么被折叠?



