As far as I know there is no standard functionality for this.
What you could do however is to use an on change event on all your input fields. Whenever something is changed you will immediately commit it, so it won't be gone when the browser buttons are used.
If necessary you can create a non-persistant entity with the same attributes as the object you are changing and associate this with the object. If the user then presses the cancel button you can reset the object to it's original state.
Hope this helps!
Matteo’s suggestion will work. Although, I would probably advise to revisit the need to do it.
In most cases, you’d want to have the user press the save button to really save the data rather than doing it on every on change. Also, if you’ve a lot of attributes and if you add a lot of on change to commit the object every time that would really be a lot of server calls to save the object again and again. Maybe talking to the stakeholder to understand what they really want would help in coming up with a different way of handling the problem or setting up a different process with the user.