How I can allow user's browser to actually leave page once beforeunload event is fired?

Dimitrios Desyllas - May 14 '21 - - Dev Community

As I ask upon stackoverflow:
https://stackoverflow.com/q/67535677/4706711

I want once user confirms that wantr to leave a page to actually leave. The code so far is:

                    window.beforeunload = function(e){
                        var confirmAction = confirm("Wanna leave? This will BREAK the page.");
                        if(confirmAction){
                            //leavePage
                        }
                    };
Enter fullscreen mode Exit fullscreen mode

But I do not know how I can allow user to leave once user accepts. Do you have any idea why?

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player