electron js get code example
Example: javascript get browser is electron
function isElectron() {
if (typeof window !== 'undefined' && typeof window.process === 'object' && window.process.type === 'renderer') {
return true;
}
if (typeof process !== 'undefined' && typeof process.versions === 'object' && !!process.versions.electron) {
return true;
}
if (typeof navigator === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent.indexOf('Electron') >= 0) {
return true;
}
return false;
}
if(isElectron()){
console.log("Electron aww yeahhh !");
}else{
console.log("Running in other platform as a normal browser");
}