這個話題幾乎都是這麼說的。如果用戶決定留在頁面上,我想顯示另一個div。如果他們拒絕頁面導航,是否有我可以聽的活動? 我在這裏找到這個,Detecting whether user stayed after prompting onBeforeUnload 但我無法得到這個工作。我沒有「擁有」顯示的按鈕,所以我無法監控點擊,或者我可以嗎?
這裏是我的代碼: $(window).on('beforeunload', function() {
if ($('.jqmCustomize').css('display') == 'block')
return 'You have not save your customization yet.';
});
這適用於Chrome和Firefox罰款,但在Interne