As follows:
<script src= ". /assets/js/jquery-1.10.2.js "></script>
Method 1
Switch
<script>window.$ = Window.jquery = require (".. /assets/js/jquery-1.10.2.js ") </script>
Can.
Method 2:
or in
Win = new Browserwindow ({ webpreferences:{ nodeintegration:false, } })
Note that it is not possible to use Nodejs and electron APIs in the page.
Method 3:
<script>window.noderequire = Require;delete Window.require;delete window.exports;delete window.module;</ Script><script src= ". /assets/js/jquery-1.10.2.js "></script>
Reason:
In fact, there is the following code in the electron:
if (typeof module = = = "Object" && typeof module.exports = = = "Object") { //Set jQuery in ' module '} else {
//set jQuery in ' window '}
Reference 1:https://electron.atom.io/docs/faq/#i-can-not-use-jqueryrequirejsmeteorangularjs-in-electron
Reference 2:https://github.com/electron/electron/issues/254
Electron Front page Import jQuery error uncaught referenceerror:jquery is not defined