check whether app is running in electron or angular code example
Example 1: how to check whether we are running on electron or browser
npm install --save is-electron
Example 2: 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");
}