Ckeditor problems solved

Source: Internet
Author: User

The ckeditor component was used in a recent project. While lamenting the powerful use of the ckeditor component, it has been deeply plagued by some minor problems for a long time, the problems and solutions are summarized as follows (ckeditor version 3.5.3 is used ):

1. In ckeditor. after the JS file is displayed normally in the IE browser, but it is not displayed in the Firefox (Version 4.0) browser. After viewing the file with firebug, the system prompts that there are several file encoding errors in ckeditor, the ckeditor file uses UTF-8 encoding, while the Javascript file encoding is converted to ISO-8859-1 when loading the Firefox page, the error message returned when Chinese encoding is not supported. (The error may be caused by a space before the comment added by ckeditor ). Since then no matter how unified encoding for UTF-8 (JS files, pages), and in the page loading JS designated encoding format are useless, Firefox or as always to load JS files into the ISO-8859-1 format, the last step is to delete all the prompts in ckeditor for encoding errors. At this time, the prompt on the editing box is garbled Chinese, in desperation had to copy the content in the zh-cn.js to the page, then the cdeditor will read the page containing Chinese script code, this solves the problem of garbled Chinese characters in the editing box on the Firefox browser.

(If anyone can solve the problem of specifying the JS encoding format when loading JavaScript files in Firefox, let's take a look !)

 

2. When setting values for the ckeditor edit box, ckeditor is used. instances. content. when the setdata () method is set to a value, the system prompts that the function is faulty. It is assumed that the set content contains ckeditor and the added format contains quotation marks. The solution is to directly assign the value to the content of textarea, for example: <textarea Cols = "90" rows = "10" id = "content" name = "content"> <p>/n <span style = "color: # ff0000; "> I am a Chinese </span> </P>/n </textarea>. ckeditor parses the content of textarea into its own editing box.

 

The following are related issues:

3. After the jquery asynchronous request is used, the JSON string returned by the server is parsed as "?" in Chinese. The general solution is to unify all file codes. After all the codes are unified, the problem still persists (the interceptor code is consistent ), then, add response in the action. setcharacterencoding ("UTF-8"); problem resolved.

 

4. I was not familiar with jquery's asynchronous request return mechanism in the past. After the request action, "Return;" or "return NULL;" is often used ;", I am not very concerned about how the jquery request is processed when the action returns the success page. I want an asynchronous request in the project, but want it to jump to the success page after execution, after multiple tests, I finally decided: jquery. after an Ajax request, the jump to the action is directly filtered out (is the description accurate here ?). In this way, you can only define the success or failure jump page in the success or failure method after the Ajax request.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.