March 17, 2011

Chek Windows Vista using Javascript

Question by Pankaj

how can i found Windows Vista Service Pack version using javascript..

Answer by Starx

By using Javascript try
alert(navigator.userAgent));

However I am not sure if, it is cross browser. Better way would be to use server side languages.

By using PHP, you can do this.

<? echo $_SERVER['HTTP_USER_AGENT']; ?>

Both, Javascript and PHP outputs something like this

Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12

You can detect the OS using this output as Windows NT 6.1 is Windows 7

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!