dimsemenov/Magnific-Popup

Check if page changed before closing

jgoullet opened this issue · 0 comments

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!