The ewebeditor editor button is invalid. The ewebeditor editor cannot be used in IE8.

Source: Internet
Author: User
Tags try catch

The ewebeditor editor button is invalid. In IE8, The ewebeditor cannot use two solutions. One is to modify the JS file by using the following methods, in fact, we can also use the second method by adding this sentence to the page.

CopyCode The Code is as follows: <meta http-equiv = "X-UA-compatible" content = "Ie = 7"/>

OrCopy codeThe Code is as follows: <meta http-equiv = "X-UA-compatible" content = "Ie = emulateie7"/>

The two meanings above are the same, and the writing method is slightly different.

Modify the JS file as follows:
Find the editor in the ewebeditor directory. JS file, path: webedit \ include \ editor. JS (webedit/JS/editor in different versions may not be the same in different paths. JS), find the following code:Copy codeThe Code is as follows: if (element. yuseronclick ){
Eval (element. yuseronclick + "anonymous ()");
}

OrCopy codeThe Code is as follows: if (element. yuseronclick) eval (element. yuseronclick + "anonymous ()");

Different versions may be written differently.
Replace the above CodeCopy codeThe Code is as follows: if (navigator. appversion. Match (/8./I) = '8 .')
{
If (element. yuseronclick) eval (element. yuseronclick + "onclick (event )");
}
Else
{
If (element. yuseronclick) eval (element. yuseronclick + "anonymous ()");
}

Check whether the ewebeditor button works properly in the background.

With such a piece of code, you can make a judgment on the browser version. IE6 should also be used.
Summary:

If we need to keep making judgments with the upgrade of IE, isn't it even more sweaty. Therefore, it is cost-effective to make an editor by yourself. After all, the ewebeditor we use is free and official services will not be provided free of charge.

enhanced version:
it is strange that some friends have installed IE8 and the navigator is displayed locally. the appversion is IE8, but it is not ie8. as shown in figure
by editing the pop-up figure, we add fault tolerance, because only these two situations usually occur, so we can solve this problem with a fault tolerance try catch. The compatibility is better than the above. For more information, see the Code copy the Code . The Code is as follows: if (element. yuseronclick) {
try {
eval (element. yuseronclick + "anonymous ()");
}< br> catch (ERR) {
eval (element. yuseronclick + "onclick (event)");
}< BR >}

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.