https://apidocs.mendix.com/5/client/mxui_mixin__Stateful.html ?
Edit 1: Can you use the javascript history.back() and history.forward()?
Perhaps I need to rephrase. I have a hotkey widget which allows for moving back and forward in browser history by using (formerly) using mx.screen.back() & mx.screen.forward(). The methods have been deprecated and I'm searching for the correct way to implement this functionality.
You can navigate through history using the browser's history API. The client gets notified by the browser and pick up the new location.
If you want to store state in your custom widget, then you can indeed use the Stateful mixin as mentioned by Chris de Gelder.