Using postMessage with <webview> tag


Greetings to all,

I’m pretty new to Electron so my question might certainly sound stupid, yet here it is.

In order to improve the security in a project of mine, obviously an Electron embedded app, I’m considering using a webview tag in order to isolate an hosted web page. Essentially, I want to avoid the webview content to get access to node and thereby, forbid it to try something like require(‘fs’)…

The Electron webview looked appealing until I realised that there is no way, at least straightforward and known to me, to call the usual postMessage() method on it. Instead, it seems that we should use the send() method which, in order to work properly, requires to allow the webview to integrate node, via the nodeintegration attribute, which is exactly what I’m trying to avoid…

So, does somebody knows how to use the postMessage() method on an Electron webview, or should I rather consider using an iframe or something else ?

Thanks for your answers.