PDA

View Full Version : Detect Windows XP in ExtJS 4.x



spaque99
13 Jun 2013, 7:27 AM
Hi all,

Anyone has a neat trick to detect the user is using WinXP as his OS?

I see there is Ext.isWindows, but nothing that tells me the version...

Thanks
Seb

eric.cook
13 Jun 2013, 2:15 PM
Without asking your reasons for wanting to do this, you can check the value of navigator.userAgent and compare it against Microsoft's published list of Platform Tokens.

http://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx#PltToken

(http://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx#PltToken)A Windows XP userAgent might look like this:


Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 5.1; Trident/5.0)


The "Windows NT 5.1" part identifies the OS as Windows XP.