我的網站顯示彈出框,當有人試圖離開我的網站,我想向他們展示彈出消息。我試圖使用window.onbeforeunload
函數,但它不起作用。留下與消息
<script language="JavaScript">
window.onbeforeunload = confirmExit;
function confirmExit(){
return "You have attempted to leave this page. If you have made any changes to the fields without clicking the Save button, your changes will be lost. Are you sure you want to exit this page?";
}
</script>
嗨喬納森我想彈出顯示我的自定義消息。 目前它顯示默認的消息 - 這個頁面要求你確認你要離開 - 您所輸入的數據可能不被保存
http://stackoverflow.com/questions/19263277/open-a-custom-popup-on-browser-window-tab-close –
http://stackoverflow.com/questions/16735076/popup-之前用窗被封閉 –
http://stackoverflow.com/questions/8118722/how-to-show-pop-up-survey-with-jquery-when-leaving-page – Suyog