如何使用JavaScript检测手持设备iOS浏览器?
我希望当我用iPhone上网时,我的iPhone会比我用Mac上网时收到另一条短信如何使用JavaScript检测手持设备iOS浏览器?,javascript,iphone,browser,Javascript,Iphone,Browser,我希望当我用iPhone上网时,我的iPhone会比我用Mac上网时收到另一条短信 <script type="text/javascript"> if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) { document.write("you are su
<script type="text/javascript">
if ((navigator.userAgent.match(/iPhone/i))
|| (navigator.userAgent.match(/iPod/i))
|| (navigator.userAgent.match(/iPad/i))) {
document.write("you are surfing with an iPhone");
} else {
document.write("you are not surfing with an iPhone")
}
</script>
if((navigator.userAgent.match(/iPhone/i))
||(navigator.userAgent.match(/iPod/i))
||(navigator.userAgent.match(/iPad/i))){
写下(“你正在用iPhone上网”);
}否则{
写下(“你不是在用iPhone上网”)
}
这行不通。
有人能帮我吗
对不起,我的英语不好,我来自比利时,佛兰德斯
if (navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/iPad/i))
{
alert("It's an iPhone or iPod");
}
效果不错,我刚刚用iPhone测试了一下。
谢谢你的快速回答:)啊哈:]优雅,可爱。