Navigation buttons (back / forward button)


#1

We are porting our web app into Electron and (quite unfortunately) need to implement back / forward buttons, as well as other buttons in the top bar. I recognize that desktop apps shouldn’t need back / forward buttons, but in our case, we need them.

I noticed that webcontents has two bool (canGoForward & canGoBack), can someone share some code examples on how we could potentially integrate something like this (or if there is an easier way of doing it?).

Thanks for the help!


#2

Hello, I am sure there are some poeple who can help but you need to give details as to how you are getting content on there. If you need back/forward button, I am assuming you have multiple pages in the window. How are you getting that rendered? If you have one window and one render process, you are probably loading the html using the loadUrl call correct?

If you have such buttons, I imagine you need to trigger an ipc call to the main process to load a different page. You will definitely keep to keep track of the context as well (i.e: What page the user was on just now, and before that, and before that, … etc).

This sounds very counterintuitive in my personal opinion. Porting of web application not mean you port the entire flow. If you are planning to only distribute the application from here forth, now would be a good time to change the UX.