title: How to view a PDF in an Electron BrowserWindow?
body: <p>So I have this Electron app and in one of the .html-files I link another script that provides some utility-functions to the program and one of those is this one:</p>
  
  <pre><code>function openPDF(filePath){
      let pdfWindow = new electron.remote.BrowserWindow({
          icon: './build/icon.png',
          width: 1200,
          height: 800,
          webPreferences: {
              plugins: true
          }
      });
  
      pdfWindow.loadURL(url.format({
          pathname: filePath,
          protocol: 'file:',
          slashes: true
      }));
  
      pdfWindow.setMenu(null);
  
      pdfWindow.on("closed", function () {
          pdfWindow = null
      });
  }
  </code></pre>
  
  <p>So this should use the integrated PDF-Viewer of Electron (which uses Chromium) to open the PDF in a new window. I used the infamous <code>plugins: true</code>, I tried through most of the <a href="https://github.com/electron/electron/blob/master/docs/api/browser-window.md" rel="noreferrer">thousands of preferences you can define for a BrowserWindow</a> but it always opens the window and then starts to download the file instead of displaying it. </p>
  
  <p>I triple checked the file path, the "imports" etc., updated everything but I can't seem to find the problem. Electron natively supports this since <a href="https://github.com/electron/electron/releases/tag/v1.6.4" rel="noreferrer">1.6.4</a> but it doesn't work for me.</p>
  
  <p>Help me, Stack Overflow, you are my only hope. </p>