Window won't load unless Dev Tools are toggled


#1

I’m just getting started with electron and just trying to load up a simple webview of YouTube.

main.js

var app = require('app');
app.on('ready',function(){
  const BrowserWindow = require('electron').BrowserWindow;
  var win = new BrowserWindow({ width: 800, height: 600});
  win.on('closed', function() {
    win = null;
  });
  win.loadURL('file://' + __dirname + '/index.html');
  win.toggleDevTools(); // If I remove this, it doesn't load
  win.show();
});

index.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Hello World!</title>
    <link rel="stylesheet" href="clatch.css" />
  </head>
  <body>
    <div id="views">
      <webview class="view active" src="http://youtube.com"></webview>
    </div>
  </body>
</html>

If I don’t have the devTools toggled, it won’t load. I can close them and the webview is still fine. Any idea? Thanks.


#2

I can make a short video to exhibit this if need be. Literally just deleting that line makes the webview not load.