Skip to content

Instantly share code, notes, and snippets.

@chekit
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chekit/a3459fb91e624c3e246a to your computer and use it in GitHub Desktop.
Save chekit/a3459fb91e624c3e246a to your computer and use it in GitHub Desktop.
Disable Back button on Browser and Android Hardware
(function (w) {
'use strict';
w.location.hash = "no-back-button";
w.location.hash = "Again-No-back-button";//again because google chrome don't insert first hash into history
w.onhashchange = function(){
w.location.hash = "no-back-button";
}
})(window);
//Original: http://stackoverflow.com/a/20896928
@chekit
Copy link
Author

chekit commented Aug 3, 2015

Add closure and 'use strict'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment