title: Prevent white flash between page loads electron
body: <p>Each time the window starts to loads new html or makes a makes request to the server the Window will go white until the page has finished loading or server has responded to the request. This does not look good at all and can be quite jarring.
  How can I stop this?</p>
  
  <p>The code if you wish to see it <br> app.js</p>
  
  <pre><code>const {app, BrowserWindow} = require('electron');
  const path = require('path');
  const url = require('url');
  let win;
  function createWindow () {
      // Create the browser window.
      win = new BrowserWindow({width: 800, height: 600});
      win.loadURL(url.format({
          pathname: path.join(__dirname, 'index.html'),
          protocol: 'file:',
          slashes: true
      }));
  
      win.on('closed', () =&gt; {
          win = null;
  })
  }
  app.on('ready', createWindow);
  app.on('window-all-closed', () =&gt; {
  
      if (process.platform !== 'darwin') {
      app.quit();
  }
  });
  
  app.on('activate', () =&gt; {
  
      if (win === null) {
      createWindow()
  }
  });
  </code></pre>
  
  <p>inedx.html</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
  &lt;/head&gt;
  &lt;body style="background-color: #222222"&gt;
  &lt;a href="index.html" style="color: white"&gt;Click on me to see a flash&lt;/a&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>