Click to See Complete Forum and Search --> : Showing OS in a messagebox


jellyrools
02-12-2004, 02:56 AM
im trying to make some javascript that tells you what operating system you are using. I managed to get everything to work, except i cant work out how to make an if command.
at the moment this is what i have:

var os = escape(navigator.platform);

function osSystem(){
if os = Win32
{ os = "You are currently using Windows XP."
else
"You are not using Windows."
}


where am i going wrong?

fredmv
02-12-2004, 03:14 AM
<script type="text/javascript">
//<![CDATA[
var p = navigator.platform;

alert('You are using ' + (/win/gi.test(p) ? "Windows" : (/lin|nix/gi.test(p)) ? "GNU/Linux or UNIX" : (/mac/gi.test(p) ? "Mac OS" : "a rare OS")) + '.');
//]]>
</script>

jellyrools
02-12-2004, 11:17 AM
that is well wicked :D

works perfectly thnx fredmv

------------------