ReferenceError: CKEDITOR is not defined
I am trying to use the CKeditor but the following error shows up (in JS console) when I try the sample from the tutorial and only a texbox shows in the browser.
ReferenceError: CKEDITOR is not defined [Break On This Error]
CKEDITOR.replace( ‘editor1’ );
/xampp/ (line 13)
Remove all CKEditor instances CKEditor getEditor() Error, How to fix it? Disable editing between specified tags in CkEditor How do disable options from the Format menu in CKeditor? is it possible to change the Wrapper “<div>” of Image in Image2 ckeditor plugin? CKEditor dialog select box dynamic population
Note that the sample works when I try it on my webhosting. The file ckeditor.js is accessible from the browser.
3 Solutions collect form web for “ReferenceError: CKEDITOR is not defined”
Remove the leading slash from
/ckeditor/ckeditor.js (so try with
The leading slash means the “root“.
So if you are using an URL like
http://bp.php5.cz/, and then say
/ckeditor/ckeditor.js, it will mean
http://bp.php5.cz/ckeditor/ckeditor.js. But if your URL is
localhost/xampp/, it will resolve to
localhost/ckeditor/ckeditor.js, which is not what you want.
If you omit the leading slash, the relative URL will be resolved from the “current URL”, so it will be correct in both cases.
The safest way would be of course to use the absolute URL.
If you’re loading from a CDN, check that you’re using the full URL, including the “http:” part.
In my case, I loaded the CDN script before my closing body tag, after
CKEDITOR.replace( 'editor1' ). Tossed it in the head and it’s all good.