Skip to content

Commit

Permalink
Another attempt to set UserAgent before every req
Browse files Browse the repository at this point in the history
This might prevent Issue #21 from happening
  • Loading branch information
cstayyab committed Apr 27, 2020
1 parent a151f6e commit 289cbfe
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,12 @@ function liveCheck() {
}

function createWindow() {
// Yet another attempt to handle WhatsApp Web ServiceWorker.js error (Issue #21)
session.defaultSession.webRequest.onBeforeSendHeaders((details, callback) => {
details.requestHeaders['User-Agent'] = userAgent;
callback({ cancel: false, requestHeaders: details.requestHeaders });
});

// Load the previous state with fallback to defaults
let windowState = windowStateKeeper({
defaultWidth: 800,
Expand Down

0 comments on commit 289cbfe

Please sign in to comment.