0.1.2 • Published 6 years ago
jbenvironment v0.1.2
JBEnvironment
JBEnvironment is a library that provides features for the environment where JavaScript is running.
Properties
The properties of the JBEnvironment
are shown below.
Browser related properties
BrowserVer
console.log(JBEnvironment.BrowserVer);
Chrome
if (JBEnvironment.Chrome) {
console.log('Running on Google Chrome browser');
}
else {
console.log('Running on not Google Chrome browser');
}
Edge
if (JBEnvironment.Edge) {
console.log('Running on Microsoft Edge browser');
}
else {
console.log('Running on not Microsoft Edge browser');
}
Firefox
if (JBEnvironment.FireFox) {
console.log('Running on Mozilla Firefox browser');
}
else {
console.log('Running on not Mozilla Firefox browser');
}
Gecko
if (JBEnvironment.Gecko) {
console.log('Browser base is Gecko');
}
else {
console.log('Browser base is not Gecko');
}
IE
if (JBEnvironment.IE) {
console.log('Running on Microsoft Internet Explorer browser');
}
else {
console.log('Running on not Microsoft Internet Explorer browser');
}
Opera
if (JBEnvironment.Opera) {
console.log('Running on Opera browser');
}
else {
console.log('Running on not Opera browser');
}
Safari
if (JBEnvironment.Safari) {
console.log('Running on Apple Safari browser');
}
else {
console.log('Running on not Apple Safari browser');
}
WebKit
if (JBEnvironment.WebKit) {
console.log('Browser base is Apple WebKit');
}
else {
console.log('Browser base is not Apple WebKit');
}
Device related properties
Android
if (JBEnvironment.Android) {
console.log('Running on Android device');
}
else {
console.log('Running on not Android device');
}
IOS
if (JBEnvironment.IOS) {
console.log('Running on iOS device');
}
else {
console.log('Running on not iOS device');
}
IPad
if (JBEnvironment.IPad) {
console.log('Running on iPad device');
}
else {
console.log('Running on not iPad device');
}
IPhone
if (JBEnvironment.IPhone) {
console.log('Running on iPhone device');
}
else {
console.log('Running on not iPhone device');
}
Mobile
if (JBEnvironment.Mobile) {
console.log('Running on mobile device');
}
else {
console.log('Running on not mobile device');
}
System related properties
Mac
if (JBEnvironment.Mac) {
console.log('Running on Apple macOS system');
}
else {
console.log('Running on not Apple macOS system');
}
Win
if (JBEnvironment.Win) {
console.log('Running on Microsoft Windows system');
}
else {
console.log('Running on not Microsoft Windows system');
}
Other properties
HTTPS
if (JBEnvironment.HTTPS) {
console.log('Use SSL');
}
else {
console.log('Not use SSL');
}