Electron loads preload in iframe of WebView

Time:2020-6-4

The settings are as follows:

var webview = document.createElement('webview');
//Load preload in all iframes
webview.nodeintegrationinsubframes =  true;
//Disable node integration in WebView
webview.nodeintegration =  false;

If the settings do not take effect after completion, you need to check browserwindow’s webPreferences.nodeIntegrationInSubFrames Setting: if the rendering process of WebView itself nodeintegrationisubframes is false, there is no way to issue permissions to WebView. The same is true for nodeintegration

It has been verified that the description of preload and some blogs are not very consistent. Preload will run every time WebView reloads, not only the first time it is loaded