Webwhatsapp-wrapper: Electron: WhatsApp works with Google Chrome 36+

Created on 4 Dec 2018  Â·  22Comments  Â·  Source: mukulhase/WebWhatsapp-Wrapper

Recently this error is coming up with JS file, earlier it was working fine for couple of months.

Uncaught ReferenceError: webpackJsonp is not defined

Anyone has any idea if Whatsapp has changed it's JS/Library?

Most helpful comment

here the solution: function createWindow () {
win = new BrowserWindow({width: 800, height: 600});
win.loadURL('http://www.whoishostingthis.com/tools/user-agent/',
{userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36'});

win.on('closed', () => {
win = null
});
}

All 22 comments

image

You have everything written. Upgrade your browser to version 36+

Chrome version is 66.

I have read other WhatsApp applications on github like franz and all of
them seem to have this problem recently.

Looks like some browser detection issue.

On Tue 4 Dec, 2018, 12:49 group2tts <[email protected] wrote:

You have everything written. Upgrade your browser to version 36+

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/mukulhase/WebWhatsapp-Wrapper/issues/516#issuecomment-443997051,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ATldJ96ulxJy1imrXxawWPjUCw9m_K0Gks5u1iILgaJpZM4Y_2Bj
.

You have somewhere substituted your useragent

I didn't change anything. Just that nodeintegration is true and websecurity
is turned off.

Everything was functional last week but surprisingly not anymore.

On Tue 4 Dec, 2018, 13:11 group2tts <[email protected] wrote:

You have somewhere substituted your useragent

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/mukulhase/WebWhatsapp-Wrapper/issues/516#issuecomment-444001757,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ATldJ3LtboTGl6m9Umdte3jBInu2emSAks5u1ickgaJpZM4Y_2Bj
.

Try installing the latest version Chrome.

It was chrome 65 and electron 2

I uninistalled electron

npm uninstall electron -g --save
and reinstalled

npm install electron -g
then i checked versions, it was electron 3 now and Chrome 66

Problem is still the same :-(

This is another example of same problem faced by other whatsapp web library users.

Trying to change agent, will post my findings if any success.

On Sun 9 Dec, 2018, 17:58 Beto <[email protected] wrote:

Hello

any solution to this problem?

Thanks

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/mukulhase/WebWhatsapp-Wrapper/issues/516#issuecomment-445533435,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ATldJw4sQZjcRydK1SSwrPnLhuYH1g1Bks5u3QHegaJpZM4Y_2Bj
.

I tried setting agent onbeforeSendHeaders which seem to be able to setHeaders but problem is intact :-(

session.defaultSession.webRequest.onBeforeSendHeaders((details, callback) => {
      details.requestHeaders['User-Agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36';
      callback({ cancel: false, requestHeaders: details.requestHeaders });
    });

Couldn't find a solution yet.

Please help if anyone has found a solution?

On Mon 10 Dec, 2018, 21:07 Beto <[email protected] wrote:

I did not understand your last post Does that mean it will not work?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/mukulhase/WebWhatsapp-Wrapper/issues/516#issuecomment-445859262,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ATldJyV41HkIu--WVuggfa2rxZCTJbJAks5u3n_QgaJpZM4Y_2Bj
.

Hello.

I am having the same problem, also started to occur a few days ago, after synchronizing the qrcode, it works but, its me restarting the service it presents the chrome update problem. When I remove the chromium session files it works again, but that way I always have to synchronize the QR. I'm looking for the solution too.

Hello,

Here it just stopped happening when I added the code below:

edit: ### wapi.js
https://github.com/mukulhase/WebWhatsapp-Wrapper/blob/master/webwhatsapi/js/wapi.js

add in first line:

navigator.serviceWorker.getRegistrations().then(
   function(registrations) {
       for(let registration of registrations) {
           registration.unregister();
       window.location.reload();
       }
});

I had already fix header and installed the chromium-chromium-chromedriver package for ubuntu

It's not working for me too:-(

On Wed 12 Dec, 2018, 22:44 Beto <[email protected] wrote:

Not work

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/mukulhase/WebWhatsapp-Wrapper/issues/516#issuecomment-446667519,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ATldJyILNGadh7MqXrBW9frhpFefeuXfks5u4TljgaJpZM4Y_2Bj
.

nothing to do for fixing in wapi.js
just change user-agent to

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36

and will work all again

doesn't seem to work for me, here is the code

mainWindow = new BrowserWindow({ width: 600, height: 651, visible: true,  webPreferences: {
        nodeIntegration: true,
        partition: "persist:main",
    webSecurity:false
    }})
session.defaultSession.webRequest.onBeforeSendHeaders((details, callback) => { 
        details.requestHeaders["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36"; 
        callback({ cancel: false, requestHeaders: details.requestHeaders }); 
    });
    mainWindow.loadURL("https://web.whatsapp.com",{userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36'});

here the solution: function createWindow () {
win = new BrowserWindow({width: 800, height: 600});
win.loadURL('http://www.whoishostingthis.com/tools/user-agent/',
{userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36'});

win.on('closed', () => {
win = null
});
}

here the solution: function createWindow () {
win = new BrowserWindow({width: 800, height: 600});
win.loadURL('http://www.whoishostingthis.com/tools/user-agent/',
{userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36'});

win.on('closed', () => {
win = null
});
}

This works perfect for me.

All that was needed was clearing data completely (Once) and then adding these lines to switch User Agent.

doesn't seem to work for me, here is the code

mainWindow = new BrowserWindow({ width: 600, height: 651, visible: true,  webPreferences: {
        nodeIntegration: true,
        partition: "persist:main",
  webSecurity:false
    }})
session.defaultSession.webRequest.onBeforeSendHeaders((details, callback) => { 
      details.requestHeaders["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36"; 
      callback({ cancel: false, requestHeaders: details.requestHeaders }); 
  });
  mainWindow.loadURL("https://web.whatsapp.com",{userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36'});

in wapi.js i put this code?

Here is the root of the problem: https://github.com/electron/electron/issues/16196

This is work for me:

mainWindow.webContents.on('dom-ready', function(e) {
        let script = `
            window.onunload = () => {

                navigator.serviceWorker.getRegistrations().then(
                    function(registrations) {
                        for(let registration of registrations) {
                            registration.unregister();
                        }
                    }
                )

            }
            `
        mainWindow.webContents.executeJavaScript(script)
    })
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ItachiL18 picture ItachiL18  Â·  6Comments

juancrescente picture juancrescente  Â·  4Comments

kashif-raza picture kashif-raza  Â·  5Comments

dafner picture dafner  Â·  6Comments

FeezyHendrix picture FeezyHendrix  Â·  3Comments