How does electron get the value in the webview page?

use preload to inject js into webview pages, and how to pass values to preload-injected js, webview pages in that page uses vue

Sep.05,2021

just as the main process communicates with the rendering process, the rendering process can also communicate with webview, as shown in the following code.

you can also add parameters, and you can implement your requirements in the following ways.

/ / on the page
const webview = document.querySelector ('webview')
webview.addEventListener (' ipc-message', (event) = > {
console.log (event.channel)
/ / Prints "pong"
})
webview.send ('ping')

/ / in webview
const {ipcRenderer} = require ('electron')
ipcRenderer.on (' ping', () = > {
ipcRenderer.sendToHost ('pong')
})

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e59693-65b43.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e59693-65b43.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?