I currently have an app that wraps a web page. I’m looking for a way to inject some markup (a loading spinner) into the document before the DOM has loaded (as soon as the BrowserWindow opens).
Ideally I’d like a way to hook into the browser request for the webpage and modify the response but I can’t find anything along these lines in the API.
Up until recently calling
document.write(loadingSpinnerMarkup) inside a BrowserWindow preload script was a hacky but successful way of achieving this. Now calling
document.write() in the preload script wipes the original document, which is probably the correct behaviour.
Prior to this I was using a
<webview> inside the BrowserWindow document for the external site and rendering my app UI separately. But that lead to issues with the webview lagging behind when resizing the BrowserWindow and some other unfortunate bugs.
Any suggestions welcome.