BrowserWindow with multiple html pages


Hi All,

Is there a way to switch between html pages smoothly? Maybe load them all up on boot and then show the page you want and be able to switch at any time without reloading pages? I made the mistake of making multiple browser windows which does not do what I want.




Forgive me if I’m mistaken but as Electron is based on Chrome and uses web technologies you can use tools such as jQuery, Ember, React etc. to load data and manipulate the DOM which would allow you to create pages/modals that load quickly. Apps like Slack do this. I’ve never seen Slack load data in a separate window (although I could be wrong).


No, you’re right, but I didn’t really want to get any UI framework involved if I didn’t need one. You can switch pages via BrowserWindow’s loadUrl, but that kicks off all script loading and everything just like a webpage loading, and it easiest a clean transition… was hoping to load multiple pages and then show and hide them as needed on the same browser window, if that makes sense. If I had more than a few pages, I would consider using marionettejs or something like you mentioned above… and one more reason, trying to keep dependencies low and project size small, not all ui frameworks are light weight.


Electron is designed to work best as a single-page application. It doesn’t require a framework to work this way, though many of the JS UI frameworks are built specifically to make this kind of development much easier. You might want to look at the Electron API Demos application for some examples.


Thanks lee. :slight_smile: