关闭页面时提醒用户是否确认离开
在html的body上增加onbeforeunload函数,如下:
<body onbeforeunload="event.returnValue='确定退出?';"></body>