Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用JavaScript检测手持设备iOS浏览器?_Javascript_Iphone_Browser - Fatal编程技术网

如何使用JavaScript检测手持设备iOS浏览器?

如何使用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

我希望当我用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 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测试了一下。

谢谢你的快速回答:)啊哈:]优雅,可爱。