Skip to content

Instantly share code, notes, and snippets.

@benzkji
Created July 9, 2017 21:00
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 benzkji/cc2d9439c7a74a0a592d32090fd14930 to your computer and use it in GitHub Desktop.
Save benzkji/cc2d9439c7a74a0a592d32090fd14930 to your computer and use it in GitHub Desktop.
back pattern revisited
// check: if we came frome our own site, just use history.back()
// as simple as it gets.
on_back_click: function(e) {
// this check could be further enhanced, but works quite well already.
if (document.referrer.indexOf(window.location.host) !== -1) {
e.preventDefault();
history.back();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment