Wicket and CKEditor in Internet Explorer

CKEditor was working properly in Internet Explorer while developing our Wicket application. After deployment to our demo server it wasn’t working anymore. We had no issues with FireFox/Chrome or Safari. First we thought it had to do with some timing issues but after a lot of debugging we found out the issue (and of course the solution 😉 ).

The problem was that CKEditor determines via a ‘conditional compilation’ whether the current browser is Internet Explorer or another one.
The CKEditor code (found in env.js) looked like this:

ie		: /*@cc_on!@*/false

In our case, when we used IE, this flag was always false which was incorrect. It should have been set to true via the ‘conditional compilation’: @cc_on!

By default (Deployment mode) Wicket sets the javascript compressor to the DefaultJavascriptCompressor. This compressor is responsible for stripping all comments and whitespaces (in Development mode it is set to null).
This is done in the Application class:

getResourceSettings().setJavascriptCompressor(new DefaultJavascriptCompressor());

While developing we have set Wicket in debug mode. On our demo server this is turned off ofcourse. This means that in debug mode the javascript files were not compressed and not stripped from the comments and whitespaces. In deployment mode it was compressed and stripped.

Wicket stripped out the conditional compilation (!!) to:

ie		: false

This was the reason why it wasn’t working in Internet Explorer.

To fix this don’t use the JavascriptResourceReference to add the ckeditor.js file but use a normal ResourceReference instead. The ckeditor.js is already compressed out-of-the-box.

Note: We used CKEditor 3.6.2 in combination with Wicket 1.4.18
Note 2: More information about ‘conditional compilation’ can be found here.

Leave a Reply




You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>