This is quite scummy behavior and it seems that in the future, Chrome and other Chromium-based browsers such as Microsoft Edge will prevent that from happening. In a report from Naked Security, an upcoming change to Chromium will be introducing new behavior that is designed to stop websites from abusing the back button functionality.
In this change, it will introduce behavior so that when anything is added to the user’s browser history that did not require a user gesture, will be ignored in the future. This means that current methods of trapping a user from leaving will not work. “The new behavior of the browser’s back button will be to skip over pages that added history entries or redirected the user without ever getting a user gesture. Note that the intervention only impacts the browser back/forward button UI and not the history.back/forward APIs.”
The changes have already been approved for launch so hopefully, users of Chrome will be able to see it soon. It should also be applied to Chrome across multiple platforms including Windows, Mac, Linux, Chrome OS, and Android.