Skip to content

Instantly share code, notes, and snippets.

@leto
Created August 3, 2016 22:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leto/691336b4c14f6e0371d54c1e5ed6476d to your computer and use it in GitHub Desktop.
Save leto/691336b4c14f6e0371d54c1e5ed6476d to your computer and use it in GitHub Desktop.
onbeforeunload from wordpress plugin
window.onbeforeunload = function(e) {
var e = e || window.event;
if (e) {
e.returnValue = wpp.exit_alert_text;
}
setTimeout( function(){
wpp_popup_function()
css_background = jQuery('#cboxClose').css('background');
jQuery('#cboxClose').css('background', css_background );
}, 500 );
window.onbeforeunload = null;
return wpp.exit_alert_text;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment