I’m just getting started with Electron, with prior experience with node-webkit (nw.js).
In nw.js, I was able to create iframes and then access the DOM of said iframe in order to grab things like the title, favicon, &c. When I picked up Electron a few days ago to port my nw.js app to it, I saw advice to use webviews instead of iframes, simply because they were better. Now, the functionality I mentioned above was relatively easy to do in nw.js, but I don’t know how to do it in Electron (and examples are slim to none). Can anyone help?
Also, I have back/forward buttons for my webview (and I intend on having more than one). I saw in the documentation that I could call functions for doing so on a webview, but nothing I have tried worked either (and, I haven’t found examples of them being used in the wild).
Alright, found something.
I was trying to attach Electron handlers to my
var webview = $("webview.active"); , but for some reason, that doesn’t work. What does work is
var webview = document.getElementById("tab1");, but this is highly inflexible. I intend to have more than one
webview, which is why I was trying to target it view a class.
Is it at all possible to make the handlers work with classes?
Thanks to this answer on SO, I understand that
document.getElementById("contents"); // returns a HTML DOM Object var contents = $("#contents"); // returns a jQuery Object // which led to var contents = $("#contents"); // returns a HTML DOM Object
I then tried