Jquery determines the method by which messages will pop up when the browser returns. jquery returns
There must be some messages when the browser returns. Here, jquery is used to determine whether the browser returns and a message is displayed.
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 ');}});
How to Use JS or JQUERY to determine the return operation of the browser
Is there a return operation for the browser? You can use history. forward (); history. back (); to control the browser's forward and backward functions.
How does jquery or js obtain the browser's back events?
Yes, it cannot be obtained. You can only know that the unload event, the back or forward event are not triggered, but only the onunload Event is triggered.