How to tell when at the earliest page? (i.e. can't go back further)


I am working on an electron application that uses window.history.back() as part of the UI navigation (built-in back button / toolbar disabled). Is there a simple way for the renderer process (i.e. client-side JS) to know whether or not it is at the beginning / first page?

The History API doesn’t seem to facilitate this (can check if length is 1 but that only works until the user navigates away, after which the length property no longer necessarily correlates with the “stack size” since it does not decrease when the user navigates backward).
So the only other way I see to do this is using the main process’ canGoBack function and using IPC to pass the corresponding request and responses messages.