javascript - Stop chrome back/forward two finger swipe -
i want disable 2 finger swipe causes chrome going or forward. have website user might lose progress on work if doesn't saves.
i have tried using window.onbeforeunload
doesn't seem work if have hashes in url (back forward change between www.example.com/work/#step1#unsaved www.example.com/work/#step0) , event doesn't seem trigger.
i switch solution today noticed in google docs it's disabled. how did achieve that?
you're looking @ problem @ wrong level. onbeforeunload not triggered because there nothing being unloaded browsers perspective. therefore have, quite bluntly, implemented wrong mechanism versioning - fragments page states, not document states using now.
if insist on maintaining state through hash fragments need use mechanism guard against page state changing. since current browsers support localstorage i'd use that. , well, while @ it, put document state data there instead of in url, since how google docs , why don't have issue.
Comments
Post a Comment