How to use <webview> methods in Electron
The online documentation <webview> provides a list of methods that you can use with the object. When I try to run any of these methods, none of them work. When I looked at the properties of the element <webview>in the inspector, it says its prototype webview. ( __proto__ : webview)
It is in this prototype that all methods are stored. Therefore, my element should basically just inherit these methods from its prototype when I use these methods (e.g. myWebview.openDevTools()).
However! when i use Object.getProptotypeOf(myWebview)i get HTMLElementNOT webviewas shown in the inspector.
Here is an example of my code:
<webview id="myWebview" src="path/to.file"></webview>
<script>
var myWebview = document.getElementById('myWebview');
console.log("myWebview: ",myWebview);
console.log("prototype: ",Object.getPrototypeOf(myWebview)); //=> HTMLElement
myWebview.openDevTools();
</script>
+4
2 answers