Electron - Jquery Errors
I'm working on an Electron project, and when attempting to include jQuery, I get this error: C:\Users\Matthew\Documents\Electron\ElectronProjects\Iris\js\jquery.min.js:4 Uncaught S
Solution 1:
<scripttype="text/javascript">window.$ = window.jQuery = require(__dirname+'/js/jquery.js');
</script>
I used this for jquery 1.9.1 version its works fine.
Solution 2:
Looks like adding "node-integration": false
to my BrowserWindow constructor fixed it. I'd still like an explanation why I have to do so though :)
Solution 3:
To answer "why", according to this post: https://github.com/atom/electron/issues/254
"jQuery contains...
if ( typeofmodule === "object" && typeofmodule.exports === "object" )
{
// set jQuery in `module`
}
else
{
// set jQuery in `window`
}
module is defined, even in the browser-side scripts. This causes jQuery to ignore the window object and use module, so the other scripts won't find $ nor jQuery in global scope.."
Post a Comment for "Electron - Jquery Errors"