Warn the user if leave the current page using javascript

     In some situation user have chance to wrongly press back, close or reload button in browser, if we want to show any waning message we can use the onbeforeunload event.

Example

    window.onbeforeunload = function() {

        return "Are you sure to go back?";

    };



Example Program:- (Editor)


Editor is Loading...

Advertisement

Nhận xét

Bài đăng phổ biến từ blog này

How to set the SDK, NDK and JDK path to android studio?

physicsjs - Increase the restitution value for circle and retangle

Select all values from list box in a single click using javascript