Bharanikumar Bharanikumar - 6 months ago 25
Javascript Question

Jquery Conflict for back button code snippet

upgraded from 1.4 to v=1.7

Here i am placing couple of request.


  1. jquery snippet conflict

  2. Back button snippet




TypeError: $j(...).on is not a function


How popup alert when someone clicked the back button, below is the code but looks not working, still i have one more issue that is conflict, can you some one suggest the best way to resolve this issue.

jQuery(function () {
if (window.history && window.history.pushState) {
window.history.pushState('', null, './');
jQuery(window).on('popstate', function () {
alert('Back button was pressed.');
window.location.reload();
});
}
});

Answer

From the documentation for on:

version added: 1.7

You must be using an older version of jQuery. Upgrade to a current version.

Comments