Changes between Version 3 and Version 4 of Ticket #9958, comment 7


Ignore:
Timestamp:
Feb 13, 2013, 5:42:17 PM (12 years ago)
Author:
Alistair
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #9958, comment 7

    v3 v4  
    1 Started working with CKEditor a couple of days ago and already came across this annoying onBeforeUnload triggering in IE. After a bit of fiddling I found the following works perfectly from your main page script block.
     1Started working with CKEditor a couple of days ago and already came across this annoying onBeforeUnload triggering in IE. After a bit of fiddling I found the following should work perfectly from your main page script block.
    22
    3 It's a variation on ddouble's approach above, but doesn't require modifying CKEditor, and it covers links by ''behaviour'' (ie. ones that use "javascript:void(0)"), rather than by the class name "cke_dialog_ui_button", which could change or not cover all affected links.
     3It's a variation on ddouble's approach above, but doesn't require modifying CKEditor. Also it addresses links by ''behaviour'' (ie. ones that use "javascript:void(0)"), rather than by the class name "cke_dialog_ui_button", which could change or not cover all affected links.
    44
    55{{{
     
    99
    1010    // When a dialog shows, get its base element and search
    11     // for all links with void(0) in the href but without an onclick,
    12     // then replace the href with "###". This prevents IE from triggering
    13     // onBeforeUnload, and "###" (instead of "#") stops page jumping to top.
     11    // for all links with "void(0)" in the href, then replace
     12    // the href with "###". This prevents IE from triggering
     13    // onBeforeUnload, and "###" (instead of "#") stops browser
     14    // jumping to top of document when the link is clicked.
    1415
    1516    $(dialogShowEvent.data._.element.$)
    16     .find('a[href*="void(0)"]:not([onclick])').each(function(i, e) {
     17    .find('a[href*="void(0)"]').each(function(i, e) {
    1718      e.href = "###";
    1819    });
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy