在控制台运行如下代码, window.onbeforeunload = function() { return "\n Are you ture to leave?";} 然后在跳转时会alert弹窗,点击取消就会阻止页面跳转。