[SOLVED][Drupal] ReferenceError: CKEditor is not defined

| | 1 min read

In one of the Drupal projects I worked on I happened to notice a Javascript error message " ReferenceError: CKEditor is not defined " which caused a number of issues in the normal working of CKEditor. If you are facing the same error message when using CKEditor in your Drupal site and want to know how to fix then read on.

Here is how I removed the error message.

When I started debugging this error, I realized that the issue occurs in those pages which have no CKEditor. On further inspection of the JS code I had developed, I realized that the CKeditor instances and variables need to know if the CKeditor is present in the current page or not which was currently not been done causing the error message to popup.

So I added the following lines of code to the JS file and place the rest of the code inside that.

//  Checks whether CKEDITOR is defined or not
if (typeof CKEDITOR != "undefined") {


This stopped the error message from popping up. Try this in your site and let us know if it fixes the issue for you.