[wp-trac] Re: [WordPress Trac] #4196: "Are you sure you want to navigate away from this page?" prompt when not using the RTE

WordPress Trac wp-trac at lists.automattic.com
Wed May 2 23:50:06 GMT 2007


#4196: "Are you sure you want to navigate away from this page?" prompt when not
using the RTE
------------------------------------------------+---------------------------
 Reporter:  johnbillion                         |        Owner:  rob1n   
     Type:  enhancement                         |       Status:  assigned
 Priority:  normal                              |    Milestone:  2.3     
Component:  Administration                      |      Version:  2.1.3   
 Severity:  normal                              |   Resolution:          
 Keywords:  quicktags onbeforeunload has-patch  |  
------------------------------------------------+---------------------------
Comment (by johnbillion):

 rob1n, [http://trac.wordpress.org/attachment/ticket/4196/4196.my.diff your
 new patch] doesn't seem to work. On line 402 of `wp-
 includes/js/quicktags.js` there is no need for to call `confirm` as this
 is handled automatically by the browser.

 The `onbeforeunload` event is a strange one indeed. All you need to pass
 to it is a string which then gets displayed in a prompt
 ([http://trac.wordpress.org/attachment/ticket/4196/confirm.png
 screenshot]). The string is prepended with "Are you sure you want to
 navigate away from this page?" and appended with "Press OK to continue or
 Cancel to stay on the current page." This is cross-browser (IE and Fx at
 least) functionality.

 Also, the check for emptiness in the content area needs to use `innerText`
 and not `innerHTML`.

 HOWEVER. All that said, I've just noticed a bug in that (with my first
 patch applied) the prompt appears when you hit one of the submit
 (Save/Publish, etc) buttons and it shouldn't.

 New patch attached.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/4196#comment:11>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list