<p dir="auto">Below is my code:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="var app = require('app');
var ipc = require('ipc');
var BrowserWindow = require('browser-window');
var settings = require('./settings');

var mainWindow = null;

app.on('window-all-closed', function() {
  if (process.platform != 'darwin') {
    app.quit();
  }
});

app.on('ready', function(){
    var mainWindow = new BrowserWindow({
        fullscreen: true,
        autoHideMenuBar: true
    })

     mainWindow.loadUrl('file://' + __dirname + '/index.html') // FIRST WEBPAGE

    mainWindow.on('closed', function() {
    mainWindow = null;

  });

    ipc.on('redirect', function(){
        mainWindow.loadUrl('http://192.168.1.10/page2')  // SECOND WEBPAGE

        mainWindow.webContents.on(&quot;did-fail-load&quot;, function() {
            console.log(&quot;did-fail-load&quot;);

            mainWindow.loadUrl('file://' + __dirname + '/index.html');   
 // REDIRECT TO FIRST WEBPAGE AGAIN
        });

    });"><pre class="notranslate"><code class="notranslate">var app = require('app');
var ipc = require('ipc');
var BrowserWindow = require('browser-window');
var settings = require('./settings');

var mainWindow = null;

app.on('window-all-closed', function() {
  if (process.platform != 'darwin') {
    app.quit();
  }
});

app.on('ready', function(){
    var mainWindow = new BrowserWindow({
        fullscreen: true,
        autoHideMenuBar: true
    })

     mainWindow.loadUrl('file://' + __dirname + '/index.html') // FIRST WEBPAGE

    mainWindow.on('closed', function() {
    mainWindow = null;

  });

    ipc.on('redirect', function(){
        mainWindow.loadUrl('http://192.168.1.10/page2')  // SECOND WEBPAGE

        mainWindow.webContents.on("did-fail-load", function() {
            console.log("did-fail-load");

            mainWindow.loadUrl('file://' + __dirname + '/index.html');   
 // REDIRECT TO FIRST WEBPAGE AGAIN
        });

    });
</code></pre></div>
<p dir="auto">I will first go into the first webpage, then after it received a command "redirect" from the javascript using ipc module, it will redirect to a second webpage. But I need to check whether or not the second webpage can be connected. If it cannot be connected (did-fail-load), it will go to the first webpage again. And the cycles goes on.</p>
<p dir="auto">I use the console.log("did-fail-load") to check whether or not it had failed to connect to the second page. But I found out that it had duplicated call. The first time it fail to connect to second webpage, there is one console.log("did-fail-load"), when it retry the second time, there is two console.log("did-fail-load") appear, and the 3rd time it retry, there is three console.log("did-fail-load") appear. Is it that it some how got duplicated calls on mainWindow?</p>
<h3 dir="auto">Preflight Checklist</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have read the <a href="https://github.com/electron/electron/blob/master/CONTRIBUTING.md">Contributing Guidelines</a> for this project.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I agree to follow the <a href="https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md">Code of Conduct</a> that this project adheres to.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the issue tracker for an issue that matches the one I want to file, without success.</li>
</ul>
<h3 dir="auto">Issue Details</h3>
<ul dir="auto">
<li><strong>Electron Version:</strong>
<ul dir="auto">
<li>8.2.0</li>
</ul>
</li>
<li><strong>Operating System:</strong>
<ul dir="auto">
<li>Windows 10 Pro (1903)</li>
</ul>
</li>
</ul>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto">'show' event on a BrowserWindow fires when a window is first shown on all platforms.</p>
<h3 dir="auto">Actual Behavior</h3>
<p dir="auto">'show' event fires on mac, but not on win.</p>
<h3 dir="auto">To Reproduce</h3>
<p dir="auto">fiddle gist: <a href="https://gist.github.com/5cae7ebca7c33226a49c06f6a177c258">https://gist.github.com/5cae7ebca7c33226a49c06f6a177c258</a></p>