2020-03-20 20:28:31 +00:00
|
|
|
const { ipcRenderer } = require('electron');
|
2019-07-17 00:13:05 +00:00
|
|
|
|
|
|
|
if (process.isMainFrame) {
|
|
|
|
window.addEventListener('DOMContentLoaded', () => {
|
2020-03-20 20:28:31 +00:00
|
|
|
const webview = document.createElement('webview');
|
|
|
|
webview.src = 'about:blank';
|
2021-03-01 21:52:29 +00:00
|
|
|
webview.setAttribute('webpreferences', 'contextIsolation=no');
|
2019-07-17 00:13:05 +00:00
|
|
|
webview.addEventListener('did-finish-load', () => {
|
2020-03-20 20:28:31 +00:00
|
|
|
ipcRenderer.send('webview-loaded');
|
|
|
|
}, { once: true });
|
|
|
|
document.body.appendChild(webview);
|
|
|
|
});
|
2019-07-17 00:13:05 +00:00
|
|
|
} else {
|
2020-03-20 20:28:31 +00:00
|
|
|
ipcRenderer.send('preload-in-frame');
|
2019-07-17 00:13:05 +00:00
|
|
|
}
|