18 Eylül 2019 Çarşamba

Web sayfasında geri tuşunu pasif etmek ...

        history.pushState(null, null, location.href);
     
 window.addEventListener('popstate', function (event) {
         
 // The popstate event is fired each time when the current history entry changes.

            var r = false;// confirm("Geri butonu çalışmayacak..?!");

            if (r == true) {
                // Call Back button programmatically as per user confirmation.
                history.back();
                // Uncomment below line to redirect to the previous page instead.
                // window.location = document.referrer // Note: IE11 is not supporting this.
            } else {
                // Stay on the current page.
                history.pushState(null, null, window.location.pathname);
            }

            history.pushState(null, null, window.location.pathname);

        }, false);

Hiç yorum yok: