Javascript, Programming

How to Get System Informations Using Javascript

//Application Code Name
var codeName = navigator.appCodeName;

//Application Name
var appName = navigator.appName;

//Application Version
var appName = navigator.appVersion;

//User Language and Language
var language = getLanguage();

function getLanguage() {

if (navigator.userLanguage == “string”) {
return(navigator.userLanguage);
} else if (navigator.language == “string”) {
return(navigator.language);
} else {
return(“(Not supported)”);
}
}

//Platform
var appName = navigator.platform;

//User Agent
var userAgent = navigator.userAgent;

//Java Enabled
var javaEnabled = navigator.javaEnabled();

//Browser Version Major
var versionMajor = parseInt(navigator.appVersion,10);

//Browser Version Minor
var versionMinor = versionMinor();

function versionMinor() {

var versMajor = parseInt(navigator.appVersion,10);
var appVers = navigator.appVersion;

var pos, versMinor = 0;

if ((pos = appVers.indexOf (“MSIE”)) > -1) {
versMinor = parseFloat(appVers.substr (pos+5));
} else {
versMinor = parseFloat(appVers);
}

return (versMinor);
}

//Screen Width
var screenWidth = screenWidth();

function screenWidth() {

if (window.screen) {
return(screen.width);
} else {
return(0);
}
}

//Screen Height
var screenHeight = screenHeight();

function screenHeight() {

if (window.screen) {
return(screen.height);
} else {
return(0);
}
}

mycodetips

Passionate about coding and software development holding 10+ Years of experience including 6+ years of experience on Mobile application Development.

More Posts