dimsemenov / Magnific-Popup

Light and responsive lightbox script with focus on performance.
http://dimsemenov.com/plugins/magnific-popup/
MIT License
11.38k stars 3.5k forks source link

Check if page changed before closing #1178

Open jgoullet opened 2 years ago

jgoullet commented 2 years ago

Hello,

I try to check if the content in page changed before closing the popup. I'm trying to use onbeforeunload function but with no success.

window.onbeforeunload = function (e) { $('.magnific-popup')magnificPopup({ callbacks: { open: function() { $.magnificPopup.instance.close = function() { var confirmed = confirm('test'); if(!confirmed) { return; }
$.magnificPopup.proto.close.call(this); } }

}); }

Thanks!