最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

tinymce - Remove "Are You Sure" dialogue when leaving editor

programmeradmin1浏览0评论

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

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 asked Dec 8, 2011 at 17:55 endle.wintersendle.winters 3392 silver badges6 bronze badges
Add a comment  | 

3 Answers 3

Reset to default 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' ); 
?>
tinyMCE.init({
     .................................

     .................................

    autosave_ask_before_unload:false
  })

as this page

you must to add "autosave_ask_before_unload: false" in init of tinymce(as bottom code):

tinymce.init({
        mode: 'textareas',
        menubar: false,
        statusbar: false,
        language: 'sv_SE',
        autosave_ask_before_unload: false,
        ...

and you must be add bottom code in your page:

<script>
window.onbeforeunload = function() {};
</script>
发布评论

评论列表(0)

  1. 暂无评论