Skip to content

Instantly share code, notes, and snippets.

@Kilian
Created July 25, 2022 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kilian/33fd4a9ac6db6b28b1dcc5b765edb622 to your computer and use it in GitHub Desktop.
Save Kilian/33fd4a9ac6db6b28b1dcc5b765edb622 to your computer and use it in GitHub Desktop.
missing getUserAgent data
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<script>
document.write(window.navigator.userAgent)
</script>
</body>
</html>
const { app, BrowserWindow } = require('electron')
const path = require('path')
function createWindow () {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js')
}
})
console.log(
"user agent: ",
mainWindow.webContents.getUserAgent()
)
mainWindow.loadFile('index.html')
}
app.whenReady().then(() => {
createWindow()
})
app.on('window-all-closed', function () {
app.quit()
})
{
"name": "successful-anxiety-buy-i45em",
"productName": "successful-anxiety-buy-i45em",
"description": "My Electron application description",
"keywords": [],
"main": "./main.js",
"version": "1.0.0",
"author": "kilian",
"scripts": {
"start": "electron ."
},
"dependencies": {},
"devDependencies": {
"electron": "20.0.0-alpha.5"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment