One way to detect cloud9-ide is to check if C9_PROJECT
environment variable is set:
if (process.env.C9_PROJECT) {
console.log('Running on C9 IDE');
} else {
// ...
}
There are also other variables prefixed with C9. You can check them if you want to.