0

How do I identify whether the visitor's mobile is windows based or not? I have code for iPhone and Android but can anyone help for windows based phones?

$iPhone  = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$Android = stripos($_SERVER['HTTP_USER_AGENT'],"Android");
tanou
  • 1,083
  • 2
  • 13
  • 33
  • and possible duplicate here : http://stackoverflow.com/questions/9926504/how-do-i-check-windows-phone-useragent-with-javascript – tanou May 07 '14 at 07:05

3 Answers3

4
var isMobile = {
    Android: function() {
        return navigator.userAgent.match(/Android/i);
    },
    BlackBerry: function() {
        return navigator.userAgent.match(/BlackBerry/i);
    },
    iOS: function() {
        return navigator.userAgent.match(/iPhone|iPad|iPod/i);
    },
    Opera: function() {
        return navigator.userAgent.match(/Opera Mini/i);
    },
    Windows: function() {
        return navigator.userAgent.match(/IEMobile/i);
    },
    any: function() {
        return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
    }
};
SergeevDMS
  • 801
  • 6
  • 15
1

Try this for your language of choice: http://detectmobilebrowsers.com

There are even scripts for apache and nginx if you want to do it at the HTTP server level.

smyrgl
  • 864
  • 6
  • 12
0

Seems to be "Windows Phone" for WP 8 and "Windows Phone OS" for previous version. But you can also look for the browser agent "IEMobile".

I suggest you to read this article: http://blogs.windows.com/windows_phone/b/wpdev/archive/2012/10/17/getting-websites-ready-for-internet-explorer-10-on-windows-phone-8.aspx

If it's still not work just try to log the user agent while connecting with a windows phone and you'll got the solution.

tanou
  • 1,083
  • 2
  • 13
  • 33