I think this happened to me some weeks ago but I am blogging about it only now (the last month or so has been overly hectic, so no time for “exotic” activities like blogging).

In an ASP.NET website installation that has been running perfectly for months and using CKEditor for wysiwyg content entry, suddenly the users started reporting they can no longer click the “Link” button in the editor toolbar to bring up the Link dialog for turning the selected text to a hyperlink.

We had not done any recent update to the installation, so the issue came as a surprise to me. On basic inspection, I found CKEditor was throwing this error when I clicked on the “Link” button in the toolbar:

 

[CKEDITOR.dialog.openDialog] Dialog "link" failed when loading definition

 

Hmmm, what could cause that, I thought as I began researching into the issue. A quick Google search brought up many result links with the same issue, so I thought others have faced it too and I might be in for an easy solution.

However all googling results directly or indirectly took me to this ticket on CKEditor’s developer site which says the issue occurs in IE 6 (causing no dialogs to open in IE 6). A patch was also available. But I was not interested as I was facing the issue in Chrome browser and in every other browser I tested upon. So this ticket did not apply to me and I continued looking for another solution. I got nothing on the web which pointed in another direction for this issue apart from the above ticket page.

So I sat down and observed the issue more closely including http traffic. And as soon as I did that (monitored http traffic), I got my solution. I noticed a “404 (Not Found)” error for the javascript file “ckeditor/plugins/link/dialogs/link.js” after I clicked the “Link” button. Why on earth this would happen I said to myself. And when I checked the web-server, I noticed the whole “ckeditor/plugins/link” directory missing (which contains the files that make up the “link” plugin for CKEditor). I also noticed some other plugin directories missing.

As I restored the missing plugin directories on the web-server, refreshed the browser and clicked the “Link” button, the issue went away and voila, I had CKEditor’s link dialog in front of me.

I checked CKEditor’s source code then and was able to confirm that CKEditor throws this error when it fails to load the scripts necessary for creating a plugin’s dialog. Here’s the relevant piece of code from its source:

 

 

throw new Error('[CKEDITOR.dialog.openDialog] Dialog "'+l+'" failed when loading definition.');

 

So next time you see ‘Dialog “plugin name” failed when loading definition’ issue, you would want to check a couple of things:

  1. You are not using an outdated CKEditor version on IE 6 (see this ticket page). If yes, either patch your CKEditor script file or upgrade to latest editor version.
  2. The plugin’s directory or script files are not missing from the ckeditor\plugins directory on your web-server.

I still wonder how these plugin directories got removed in my case (webmasters for the server deny having done anything with the installation), I guess this would remain a mystery.