Changes between Version 3 and Version 4 of Ticket #9958, comment 7
- Timestamp:
- Feb 13, 2013, 5:42:17 PM (12 years ago)
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 worksperfectly from your main page script block.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 should work perfectly from your main page script block. 2 2 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.3 It'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. 4 4 5 5 {{{ … … 9 9 10 10 // 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. 14 15 15 16 $(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) { 17 18 e.href = "###"; 18 19 });