$(window).on('beforeunload', function (event) { event.returnValue = "离开页面将丢失信息"; return "离开页面将丢失信息!"; });