ReferenceError: CKEDITOR not defined

I try to use CKeditor , but when I try a sample from the tutorial, and only the text box is displayed in the browser.

ReferenceError: CKEDITOR not defined [Break On This Error]
CKEDITOR.replace ('editor1'); / xampp / (line 13)

Please note that the sample works when I try to use it with my web hosting . The ckeditor.js file is accessible from a browser.

+4
source share
3 answers

Remove the leading slash with /ckeditor/ckeditor.js (try using ckeditor/ckeditor.js ).

A leading slash means root .

So if you use a URL like http://bp.php5.cz/ and then say /ckeditor/ckeditor.js , that would mean http://bp.php5.cz/ckeditor/ckeditor.js . But if your url is localhost/xampp/ , it will solve 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 in both cases it will be correct.

The safest way is, of course, to use an absolute URL.

+5
source

In my case, I loaded the CDN script before my closing body tag, after CKEDITOR.replace( 'editor1' ) . Threw it in the head, and all this is good.

+4
source

If you are downloading a CDN, make sure that you are using the full URL, including the "http:" part.

+1
source

Source: https://habr.com/ru/post/1479518/


All Articles