I thought this would be easy but I can't figure this out.
How to tell if using Win7 or WinXP? Like details on operating system. Linux should give specifics. Mac OS version etc.
I thought to read user agent from Services.appShell.hiddenDOMWindow
and window.navigator
but on browser startup hiddenDOMWindow
isn't loaded yet.
Right now I can only get WINNT
from:
Components.utils.import("resource://gre/modules/osfile.jsm")
console.log(OS.Constants.Sys.Name)
or
console.log(Services.appinfo.OS)
console.log
of window.navigator
gives all this good stuff, how to get this without having access to window
?
appCodeName:"Mozilla"
appName:"Netscape"
appVersion:"5.0 (Windows)"
battery:BatteryManager
buildID:"20140529161749"
cookieEnabled:true
doNotTrack:"yes"
geolocation:Geolocation
language:"en-US"
mimeTypes:MimeTypeArray
mozAlarms:null
mozApps:XPCWrappedNative_NoHelper
mozCameras:CameraManager
mozConnection:MozConnection
mozContacts:ContactManager
mozId:null
mozKeyboard:XPCWrappedNative_NoHelper
mozPay:null
mozPermissionSettings:null
mozPhoneNumberService:PhoneNumberService
mozPower:MozPowerManager
mozTCPSocket:null
onLine:true
oscpu:"Windows NT 5.1"
platform:"Win32"
plugins:PluginArray
product:"Gecko"
productSub:"20100101"
userAgent:"Mozilla/5.0 (Windows NT 5.1; rv:30.0) Gecko/20100101 Firefox/30.0"
vendor:""
vendorSub:""
__proto__:NavigatorPrototype
You can use the system info service. To get the OS version
Services.sysinfo.getProperty("version");
Consult the sources for the properties supported. Also pay attention to their platform-specific meaning (e.g. on Android there is version
and kernel_version
)