Skip to content

Instantly share code, notes, and snippets.

@hiraq
Created June 5, 2012 07:16
Show Gist options
  • Save hiraq/2873287 to your computer and use it in GitHub Desktop.
Save hiraq/2873287 to your computer and use it in GitHub Desktop.
Jhistory - work with browser back and forward button
jQuery(document).ready(function() {
jQuery(window).on('popstate',function(event) {
event.preventDefault();
var eventData = event.originalEvent.state;
if(eventData === null) {
jQuery('#content').html('');
}else{
console.log(eventData);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment