Override the User Agent

It’s possible to force PSPDFKit to use the Web version and not the Electron version when loading. This is accomplished by injecting some code that monkey patches navigator.userAgent to not include Electron/ in the string.

Here’s an example that uses the current Chrome User Agent:

const chromeUserAgent =
  "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36";
Object.defineProperty(navigator, "userAgent", {
  get: () => chromeUserAgent
});

This has been tested with PSPDFKit for Web 2019.4.1

If you want to use the Electron API to modify the user agent string from the backend, refer to the Electron documentation.