How to get the inner html from <webview> or


I can not find a way to get the html from webview or ,when the page loaded
could some one help me?


What about injecting a preload script to the webview and using ipc to communicate with your Electron app?


Have you tried using “document.getElementById(“webview_id”).innerHTML”?


I visited those links and wasn’t able to get anything to work. Could you provide an example of getting the title of a webpage in a <webview>?


Who ever lands on this page can follow the below code to get html from webview.
We can get content through IPC


webview.addEventListener("ipc-message", function (e) {
        if ( === "html-content") {
            var html_contents = e.args[0];


     var ipcRenderer = require('electron').ipcRenderer;
    document.addEventListener("DOMContentLoaded", function () {
        ipcRenderer.sendToHost('html-content' , document.body.innerHTML);