I am currently developing a web-based application for internal use in the company I work for. The application is quite intricate, featuring numerous forms that will enable users to both view and input data, which will then be stored in a database upon saving.
My main concern is preventing a scenario where a user enters a substantial amount of data on the browser but leaves the page without saving the changes, either intentionally or unintentionally. As a measure to address this issue, I have created an entry page that opens up in a new browser window with no navigation controls, only those provided within the web pages themselves.
However, there are still two possible ways through which data could be lost:
The Close button on the browser remains enabled, allowing users to accidentally lose their work by clicking it. While this is concerning, I consider it one extreme end of safeguarding users from potential mishaps.
In Internet Explorer (and reportedly in Firefox), the Backspace key functions as a backward navigation button. I stumbled upon this discovery by accident and have yet to find a straightforward solution to prevent this behavior. It poses a risk because pressing the Delete key inadvertently (such as when the cursor is in a read-only text box or unfocused on any specific field) can lead to navigating away from the page.
At the very least, my aim is to inhibit the Backspace key from triggering navigation if a page contains user-writable fields and any of these fields have been modified since the form was loaded. Ideally, I would like to disable this function of the Backspace key entirely while a user is logged into the web application. I am considering two potential methods to achieve this: (1) clearing the browser's history upon loading each page, or (2) capturing the Backspace key's action and permitting its use only when the cursor is in a field that allows text editing (like a textbox).
If anyone has suggestions on how I could implement either of these approaches, your insights would be greatly appreciated. The proposed solution must be programmatically implemented, rather than requiring manual configurations on every browser used within the company.