Resolved: I am getting this error Uncaught ReferenceError: jQuery is not defined while calling internal url


#1

Hi,

When I try to load my internal URL xyz.com in webview I am getting this error ‘jQuery is not defined’.
I can open the same url xyz.com in chrome/firefox without any issues.
Other external websites also loading without any issues.

Do I need to make any settings in electron to fix this issue.

Thanks


#2

do you open it in main or child process?!


#3

You need to turn off nodeIntegration on that WebView. It’s a good idea for security anyway, as you don’t want a remote website to be able to hi-jack your app and do things to a user’s file system, etc.

The reason this is happening is that the window defaults to having it nodeIntegration turned on, and jQuery is instead attaching to module rather than window.


#4

Hi,

I am opening webview in child process


#5

Hi,
@caffiend please find my webview settings.

<webview class="personal" id='test' allowpopups webpreferences='allowRunningInsecureContent' autosize minwidth="1100" minheight="790" plugins disablewebsecurity src="https://myinternalurl.com/home"></webview>

As per this https://electron.atom.io/docs/api/webview-tag/#nodeintegration node integration is disabled bydefult.

This is running in child process.It would be great if you can point what is the exact change i need to make in that

Thanks


#6

if you’re loading an internal URL why not use a browser window with loadURL method?


#7

@biroplane : My application is kind of a mini browser that will load lot of external URLs, in the middle I am getting internal URL also, is it possible to load that in browser window ? Please guide me on that.


#8

Hi,
Thanks for all

I removed following lines from main.js and code is working fine

app.commandLine.appendSwitch ('--disable-http-cache');
app.commandLine.appendSwitch ('--disable-http2');
app.commandLine.appendSwitch ('enable-d3d11');
app.commandLine.appendSwitch ('Scroll Prediction');
app.commandLine.appendSwitch ('Number of Raster Threads','1000000');
app.commandLine.appendSwitch ('smooth-scrolling');
app.commandLine.appendSwitch('process-per-site');

I added these lines to check some feature, some how these lines are breaking jquery feature in webview

Thanks