Jquery determines how a message pops up when the browser backs up

  • 2020-03-30 03:41:04
  • OfStack

There are bound to be some messages when the browser backs up. Jquery is used to determine that the browser is backing up and the message pops up


jQuery(document).ready(function ($) {
if (window.history && window.history.pushState) {
$(window).on('popstate', function () {
var hashLocation = location.hash;
var hashSplit = hashLocation.split("#!/");
var hashName = hashSplit[1];
if (hashName !== '') {
var hash = window.location.hash;
if (hash === '') {
alert("Back button isn't supported. You are leaving this application on next clicking the back button");
}
}
});
window.history.pushState('forward', null, './#forward');
}
});


Related articles: