prevent browser back button jquery

Solutions on MaxInterview for prevent browser back button jquery by the best coders in the world

showing results for - "prevent browser back button jquery"
Abby
29 Jun 2018
1window.onload = function () {
2    if (typeof history.pushState === "function") {
3        history.pushState("jibberish", null, null);
4        window.onpopstate = function () {
5            history.pushState('newjibberish', null, null);           
6        };
7    }
8    else {
9        var ignoreHashChange = true;
10        window.onhashchange = function () {
11            if (!ignoreHashChange) {
12                ignoreHashChange = true;
13                window.location.hash = Math.random();                
14            }
15            else {
16                ignoreHashChange = false;   
17            }
18        };
19    }
20};
21