ReferenceError: CKEDITOR is not defined

丶灬走出姿态 提交于 2019-12-10 14:54:52

问题


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)

Note that the sample works when I try it on my webhosting. The file ckeditor.js is accessible from the browser.


回答1:


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

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.




回答2:


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.




回答3:


If you're loading from a CDN, check that you're using the full URL, including the "http:" part.



来源:https://stackoverflow.com/questions/16417704/referenceerror-ckeditor-is-not-defined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!