/Electron-Webview-Host-to-Guest-RPC-Sample

Contrived example of making host to guest RPC using webview executeJavascript method and preload attribute

Primary LanguageJavaScript

Electron Webview Host to Guest RPC Sample

This is a contrived example of how to make a tool that is able to make crude RPC calls from an electron host app in the Renderer JS to a remote guest web page in a webview element.

This example uses the webview preload attribute to inject custom code into a remote websites page and invokes the code using the <webview>.executeJavaScript.

To run this:

cd <PATH_FOR_SAMPLE>
npm install && npm start

The click on one of the three buttons at the top of the page to Pause, Play or loop play and pause.

This code is based on the the cool webview browser electron sample app written by hokein. Props to you @hokein!