Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Anyone know of a nice way to disable that pop-up dialogue when exiting the post-editor? It says "This page is asking you to confirm that you want to leave - data you have entered may not be saved."

Nice feature, but annoying in certain blogs where I have to edit a ton of posts

share|improve this question

1 Answer 1

You can use the method described here. Add the following to your functions.php

<?php
function wpse35898_admin_head() {  
    ?> 
    <script type="text/javascript"> 
        window.onbeforeunload = function() {};
    </script> 
    <?php 
} 
add_action( 'admin_head' , 'wpse35898_admin_head' ); 
?>
share|improve this answer
    
I tried your code. I can see where it is inserting the script into the head but still no joy. Any thoughts? have you seen this in action? –  endle.winters Dec 8 '11 at 21:55
    
I haven't tried, but it should overwrite the window.onbeforeunload event so nothing happens. Can you track that the function is called with firebug? –  Naoise Golden Dec 9 '11 at 13:39
1  
This would work, except that the window.onbeforeunload method is redefined every time the tinymce box gets out of sync with the autosaved post. If you want to prevent it from occuring again, I think you should be able to just change the text of the confirmation message to true. ie. autosaveL10n.saveAlert = true. –  goldenapples Mar 16 '12 at 0:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.