User agent not working (e.g. whatsapp web)

Hello there,

As described in I’d like to play around with Electron (first steps in JS to be honest) and it seems I don’t get the point in it.

My Code:

const { app, BrowserWindow, Menu } = require(‘electron’)
const { webContents } = require(‘electron’)
const {dialog} = require(‘electron’)
const myUserAgent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36 ’

win.loadURL(‘’, {userAgent: myUserAgent})

I’d expect to load the Whatsapp Web loading and fully working every time I load the page.

Actual behavior is:

On first startup either via npm start or starting the build app on windows and/or macOS Whatsapp Web is working fine. After restarting the app or reloading the URL it asks me to update to Google Chrome 49+. After removing C:\Users\MyUser\AppData\Roaming\AppName and starting the app everything works flawless. After restarting the mentioned ‘update to Google Chrome 49+’ screen pops up again. Tried several user agents.

Is this something I’ve spoiled?

Cheers :slight_smile:

Were you able to find a solution to this?

I was facing a similar problem trying to load gmail. I was able to narrow the problem down to user agents that reference Chrome.

Using this Mozilla userAgent String got things purring along nicely:

“Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/72.0”

app.userAgentFallback = “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.100 Safari/537.36”;