<ul dir="auto">
<li>Electron version: v1.4.10</li>
<li>Operating system: Windows 10</li>
</ul>
<p dir="auto">While trying to find a workaround for <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="189422004" data-permission-text="Title is private" data-url="https://github.com/electron/electron/issues/7977" data-hovercard-type="issue" data-hovercard-url="/electron/electron/issues/7977/hovercard" href="https://github.com/electron/electron/issues/7977">#7977</a> using the <code class="notranslate">close</code> event of a <code class="notranslate">BrowserWindow</code>, I found out that it doesn't fire in the renderer process as it would in the main process.</p>
<h3 dir="auto">How to reproduce</h3>
<p dir="auto">Just add the following lines at the start inside <code class="notranslate">&lt;body&gt;</code> of the default app <code class="notranslate">index.html</code>:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="require('electron').remote.getCurrentWindow().on('close', evt =&gt; evt.preventDefault())"><pre class="notranslate"><span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'electron'</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-c1">remote</span><span class="pl-kos">.</span><span class="pl-en">getCurrentWindow</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">on</span><span class="pl-kos">(</span><span class="pl-s">'close'</span><span class="pl-kos">,</span> <span class="pl-s1">evt</span> <span class="pl-c1">=&gt;</span> <span class="pl-s1">evt</span><span class="pl-kos">.</span><span class="pl-en">preventDefault</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">)</span></pre></div>
<p dir="auto">But you can still close the window.</p>
<p dir="auto">This only applies to remote.BrowserWindow (i.e. the one used in renderer processess).  It works fine for the other BrowserWindow.</p>
<p dir="auto">Not sure if this is a documentation issue or an implementation issue, but the docs don't specify a difference.</p>
<p dir="auto">Ubuntu 15.10 / Electron 0.36.7</p>