Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect Electron when nodeIntegration is false #1

Closed
giuseppe-santoro opened this issue Aug 1, 2017 · 3 comments
Closed

Detect Electron when nodeIntegration is false #1

giuseppe-santoro opened this issue Aug 1, 2017 · 3 comments

Comments

@giuseppe-santoro
Copy link

How can I detect the Electron presence when I run Electron with nodeIntegration: false option?

@cheton
Copy link
Owner

cheton commented Aug 1, 2017

I never tried the nodeIntegration: false option in my projects. How about using navigator.userAgent to detect Electron presence, like below:

electron/electron#5113 (comment)

function isElectron() {
  return navigator.userAgent.indexOf('Electron') !== -1;
}

@giuseppe-santoro
Copy link
Author

It works fine. Thank you!

@cheton cheton closed this as completed in 4acaa6c Aug 2, 2017
@cheton
Copy link
Owner

cheton commented Aug 2, 2017

Added in v2.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants