Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

prevent browser back button jquery

window.onload = function () {
    if (typeof history.pushState === "function") {
        history.pushState("jibberish", null, null);
        window.onpopstate = function () {
            history.pushState('newjibberish', null, null);           
        };
    }
    else {
        var ignoreHashChange = true;
        window.onhashchange = function () {
            if (!ignoreHashChange) {
                ignoreHashChange = true;
                window.location.hash = Math.random();                
            }
            else {
                ignoreHashChange = false;   
            }
        };
    }
};
Comment

PREVIOUS NEXT
Code Example
Javascript :: mongoose connection 
Javascript :: adonis lucid join 
Javascript :: javascript only allow show first few characters from a string 
Javascript :: textbox text change jquery 
Javascript :: react native get current time 
Javascript :: id of other schema type mongoose 
Javascript :: javascript local storage delete 
Javascript :: js computed style 
Javascript :: javascript iterate array 
Javascript :: how to start json server 
Javascript :: jest global window object 
Javascript :: .innerhtml 
Javascript :: big numbers factorial js 
Javascript :: uppercase and lowercase letters in js 
Javascript :: refresh page after delete angular 
Javascript :: find max of array of objects key 
Javascript :: get day name from date javascript 
Javascript :: JS not executing 
Javascript :: javascript check if var is string 
Javascript :: js union arrays 
Javascript :: javascript delete key from object 
Javascript :: remove after js 
Javascript :: javascript redirect to another page 
Javascript :: javascript redirect to another url example 
Javascript :: js sort by property 
Javascript :: javascript make new date from hour 
Javascript :: hello world in jsp 
Javascript :: hover react component 
Javascript :: js sound 
Javascript :: js decode base64 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =