Skip to content

Instantly share code, notes, and snippets.

@linus-amg
Created April 1, 2015 19:25
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 linus-amg/8c918861b1975ca8ba0d to your computer and use it in GitHub Desktop.
Save linus-amg/8c918861b1975ca8ba0d to your computer and use it in GitHub Desktop.
Backbone.history.start({ pushState: true });
$(document).on('click', 'a:not([data-bypass])', function (evt) {
var href = $(this).attr('href');
var protocol = this.protocol + '//';
if (href.slice(protocol.length) !== protocol) {
evt.preventDefault();
app.router.navigate(href, true);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment