Ewebeditor button Failure IE8 ewebeditor Editor cannot use workaround _ Web page Editor

Source: Internet
Author: User
Tags anonymous try catch

Ewebeditor Editor button is invalid, IE8 Ewebeditor Editor is unable to use the problem-solving method has two, one is the following method by modifying the JS file, in fact, we can also use the second method by adding this sentence to the page.

Copy Code code as follows:

<meta http-equiv= "x-ua-compatible" content= "ie=7"/>

Or
Copy Code code as follows:

<meta http-equiv= "x-ua-compatible" content= "Ie=emulateie7"/>

The above two meanings are the same, the wording is slightly different.

By modifying the JS file the following operations:
Find the Editor.js file in the Ewebeditor directory, where the path is webedit\include\editor.js (different paths are not necessarily the same as the new version webedit/js/editor.js), where the following code is found:
Copy Code code as follows:

if (element. Yuseronclick) {
Eval (element. Yuseronclick + "anonymous ()");
}

Or
Copy Code code as follows:

if (element. Yuseronclick) eval (element. Yuseronclick + "anonymous ()");

Different versions may differ in wording
Replace the above code with the
Copy Code code 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 ()");
}

You are under the background test, is the Ewebeditor Editor button can be used normally.

With such a piece of code, the browser version of a judge is good, IE6 below should also be able to use.
Summary:

If with IE upgrade we have to constantly increase the judgment, it is not more Khan. So it's good to make an editor of your own, after all, we use the Ewebeditor is free official will not provide free service.

Cloud Habitat Community Enhanced Edition:
It is strange that some friends installed IE8, the local pop-up navigator.appversion is IE8, but through the edit pop-up view is not IE8. As shown in the following figure

So we're adding fault tolerance, because there's usually only two cases, so we use fault-tolerant try catch to solve the problem, compatibility is better than above. Look at the code specifically
Copy Code code as follows:

if (element. Yuseronclick) {
try {
Eval (element. Yuseronclick + "anonymous ()");
}
catch (Err) {
Eval (element. Yuseronclick + "onclick (event)");
}
}

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.