Skip to content

Instantly share code, notes, and snippets.

@john-doherty
Created February 12, 2018 11:42
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save john-doherty/a397eb423fc86e1f9a418d73dd62fbf3 to your computer and use it in GitHub Desktop.
Disable Mac swipe navigation in pure JavaScript
(function (window) {
if ((/Macintosh/gi).test(navigator.userAgent) && (/Chrome|Safari|Firefox/gi).test(navigator.userAgent)) {
history.pushState(null, null, location.href);
window.onpopstate = function(event) {
history.go(1);
};
}
}(this));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment