<ul dir="auto">
<li>Electron version: v1.3.2</li>
<li>Operating system: Windows 7</li>
</ul>
<p dir="auto">So, I wanted to convert web app to desktop app with electron. Here is web app: <a href="http://dinoz.mobi/shelter-editor/" rel="nofollow">click</a> And here is github repo: <a href="https://github.com/MobileSam/shelter-editor">click</a></p>
<p dir="auto">But when I opened it with electron as a desktop app, it's mixing a "drag file page" with next page that allows to edit that file. It looks like that:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/19797790/17445811/bed50a5a-5b46-11e6-850a-d827d523884e.png"><img src="https://cloud.githubusercontent.com/assets/19797790/17445811/bed50a5a-5b46-11e6-850a-d827d523884e.png" alt="error" style="max-width: 100%;"></a></p>
<p dir="auto">main.js:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="const {app, BrowserWindow} = require('electron')

let win

function createWindow () {
  win = new BrowserWindow({width: 1366, height: 768})
    webPreferences: {
        nodeIntegration: false
    }
  win.show()

  win.loadURL(`file://${__dirname}/shelter.html`)

  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()
  }
})"><pre class="notranslate"><code class="notranslate">const {app, BrowserWindow} = require('electron')

let win

function createWindow () {
  win = new BrowserWindow({width: 1366, height: 768})
    webPreferences: {
        nodeIntegration: false
    }
  win.show()

  win.loadURL(`file://${__dirname}/shelter.html`)

  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></div>
<p dir="auto"><strong>What's wrong?</strong></p>
<p dir="auto">jQuery contains something along this lines:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="if ( typeof module === &quot;object&quot; &amp;&amp; typeof module.exports === &quot;object&quot; ) {
  // set jQuery in `module`
} else {
  // set jQuery in `window`
}"><pre class="notranslate"><span class="pl-k">if</span> <span class="pl-kos">(</span> <span class="pl-k">typeof</span> <span class="pl-smi">module</span> <span class="pl-c1">===</span> <span class="pl-s">"object"</span> <span class="pl-c1">&amp;&amp;</span> <span class="pl-k">typeof</span> <span class="pl-smi">module</span><span class="pl-kos">.</span><span class="pl-c1">exports</span> <span class="pl-c1">===</span> <span class="pl-s">"object"</span> <span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-c">// set jQuery in `module`</span>
<span class="pl-kos">}</span> <span class="pl-k">else</span> <span class="pl-kos">{</span>
  <span class="pl-c">// set jQuery in `window`</span>
<span class="pl-kos">}</span></pre></div>
<p dir="auto">module is defined, even in the browser-side scripts. This causes jQuery to ignore the <code class="notranslate">window</code> object and use <code class="notranslate">module</code>, so the other scripts won't find <code class="notranslate">$</code> nor <code class="notranslate">jQuery</code> in global scope..</p>
<p dir="auto">I am not sure if this is a jQuery or atom-shell bug, but I wanted to put this on the web, so others won't search as long as I did.</p>