页面离开事件 onbeforeunload

<body onbeforeunload='cancelOrder();'>

cancelOrder()为页面离开调用的事件

原文地址:https://www.cnblogs.com/pumushan/p/9295258.html