Nativefier: Nativefied WhatsApp Web shows need for Google Chrome 49+

Created on 12 Sep 2019  Â·  20Comments  Â·  Source: jiahaog/nativefier

Description

When launching nativefied whatsapp web (whatsapp-nativefier from arch linux AUR), it just shows that it needs google chrome 49+.

Steps to reproduce issue

Launch WhatsApp Web Website via Nativefier.

Details

  • Are you nativefying a public website? Yes / WhatsApp Web
  • Full nativefier command used to build your app: built from AUR via yay
  • Version of Nativefier (run nativefier --version): v7.7.0
  • Version of node.js (run node --version): v12.10.0
  • OS: Manjaro Linux
  • Error message / stack trace (if any):
    Application starts fine but Website returns "Wrong Browser Version Error".

hDhDs_unknown

Sorry for the screenshot not being English.

Most helpful comment

I had the same problem. Alternatively I am entering the menu "EDIT -> Clear App Data" to be able to use the application

All 20 comments

I had the same problem. Alternatively I am entering the menu "EDIT -> Clear App Data" to be able to use the application

I had the same problem. Alternatively I am entering the menu "EDIT -> Clear App Data" to be able to use the application

Thanks for your reply!
How do you open the menu? ALT + SHIFT doesn't work and ALT does not show a "clear app data" option.

Is there a possibility to change the sent browser version/user-agent? I can't find it in the source code, so I can make a pull request.

Thanks for your reply!
How do you open the menu? ALT + SHIFT doesn't work and ALT does not show a "clear app data" option.

I am using version 0.3.2846-1, available from AUR. I use ALT which shows the "edit" menu, Clear App Data is the last submenu

Is there a possibility to change the sent browser version/user-agent? I can't find it in the source code, so I can make a pull request.

I experience the same problem.

I am using the following command to create the app:

nativefier -n "WhatsApp"  "web.whatsapp.com"  -p linux --width 640 --height 800 --single-instance   --fast-quit -e 6.0.9 --user-agent "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36"

it should force electron version to 6.0.9 and also override the user agent (which it does, according to the dev console) but it does not fix the problem for me, which may suggest the problem is NOT the user-agent string.

Used versions:
Ubuntu 18

[I] ~/s/standalone ➤ node --version
v10.16.3
[I] ~/s/standalone ➤ nativefier --version
7.7.0

Got it working again by using the following command:

nativefier -n "WhatsApp" "web.whatsapp.com" -p linux --width 640 --height 800 --user-agent "Mozilla/5.0 (X11; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0"

Changing the user agent alone did not work and leaving away the electron version did not work either.
So I think the problem must be some kind of combination.

I have built the app this way and it works:

nativefier --single-instance --clear-cache -e 6.0.9 https://web.whatsapp.com

I have built the app this way and it works:

nativefier --single-instance --clear-cache -e 6.0.9 https://web.whatsapp.com

clearing the cache does work, but having to connect your phone every time is a bit annoying...

I have built the app this way and it works:
nativefier --single-instance --clear-cache -e 6.0.9 https://web.whatsapp.com

clearing the cache does work, but having to connect your phone every time is a bit annoying...

there is no other workaround I know about, I do not use WhatsApp much anyway

Seems like the problem went away. For me, at least, running the previously failed commands now work. I guess something changed in WhatsApp itself.
I use this command now:

nativefier -n "WhatsApp"  "web.whatsapp.com"  -p linux --width 640 --height 800 --single-instance -e 6.0.11 --fast-quit  --user-agent "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36"

Same for me.
whatsapp-nativefier from AUR does work again, too.
I'm closing this issue for now.

Why do you guys force Electron 6.0.11 and not the latest 7.1.9?

I still have the problem. It only fixes it if I inject the code just like the AUR version does.

Why do you guys force Electron 6.0.11 and not the latest 7.1.9?

I still have the problem. It only fixes it if I inject the code just like the AUR version does.

Hmm, despite injecting the code I get the error: When starting the first time, everything works properly. When closing the app and restarting it, the error appears. How can this be fixed?

It's not working here, even injecting the js code :/

Do not work for me too, is nativefier broken to whatsapp-web ?

Injecting the code like in the AUR version did the trick for me, but only after I updated the message in the injected code, as I use Whatsapp in French:

In whatsapp-nativefier-inject.js:

if (document.body.innerText.replace(/\n/g, ' ').search(/whatsapp fonctionne avec.*pour utiliser whatsapp.*veuillez mettre/i) !== -1)
  navigator.serviceWorker.getRegistration().then(function (r) { r.unregister(); document.location.reload() });

Notice the French text in the search function: "_whatsapp fonctionne avec.pour utiliser whatsapp.veuillez mettre_" (instead of "_whatsapp works with.to use whatsapp.update_"). I replaced the parts of the message with the corresponding parts in the actual French error message shown in the nativefied Whatsapp.

Then add --inject whatsapp-nativefier-inject.js to the nativefier command.

Injecting the code like in the AUR version did the trick for me, but only after I updated the message in the injected code, as I use Whatsapp in French:

In whatsapp-nativefier-inject.js:

if (document.body.innerText.replace(/\n/g, ' ').search(/whatsapp fonctionne avec.*pour utiliser whatsapp.*veuillez mettre/i) !== -1)
  navigator.serviceWorker.getRegistration().then(function (r) { r.unregister(); document.location.reload() });

Notice the French text in the search function: "_whatsapp fonctionne avec.pour utiliser whatsapp.veuillez mettre_" (instead of "_whatsapp works with.to use whatsapp.update_"). I replaced the parts of the message with the corresponding parts in the actual French error message shown in the nativefied Whatsapp.

Then add --inject whatsapp-nativefier-inject.js to the nativefier command.

Thank you so much!

I did the same thing here (but in portuguese) and it worked!

if (document.body.innerText.replace(/\n/g, ' ').search(/o whatsapp funciona com.*para utilizar o whatsapp.*atualize/i) !== -1) navigator.serviceWorker.getRegistration().then(function (r) { r.unregister(); document.location.reload() });

@mr-mmmmore 's solution partially works for me, but the downside is I have to rescan the QR code everytime I launch the nativefier'd app. Any fix planned on this ?

@mr-mmmmore 's solution partially works for me, but the downside is I have to rescan the QR code everytime I launch the nativefier'd app. Any fix planned on this ?

The workaround that I used is this:

if (document.querySelector("a[href='https://support.google.com/chrome/answer/95414']"))navigator.serviceWorker.getRegistration().then(function (r) { r.unregister(); document.location.reload() });

It works in any language, and doesn't have to scan the QR code everytime.

@raulcraveiro I believe your code has the same effect as mr-mmmmore's solution (since the main logic r.unregister(); document.location.reload() is the same). I actually just restarted the app and this time it didn't ask me for QR code... Weird, but I'm not going to complain :)

Was this page helpful?
0 / 5 - 0 ratings