“Are you sure you want to leave this page?” functions for cancel and OK
问题 i'm trying to do something similar to some websites where you leave and it'll display a popup saying "Are you sure you want to leave this page" and with two options saying "Cancel" and "OK". How would I do that and make it so when you click "Cancel" it'll just cancel the box and when they click "OK" it'll do a 'leaveChat();' function and leave the website? I've tried using the onbeforeunload which was working but i'm not sure on the function part. Thanks for the help! 回答1: There is no way to