How do I check Windows Phone useragent with javascript?

前端 未结 4 1107
梦谈多话
梦谈多话 2020-12-14 17:05

I can check for iPhone with this code:

(navigator.userAgent.match(/iPhone/i))

But I want to target Windows Phone with this userAgent:

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-14 17:44

    function isIEMobile() {
        var regExp = new RegExp("IEMobile", "i");
        return navigator.userAgent.match(regExp);
    }
    

提交回复
热议问题