如何解决IE 11中CKEditor的JavaScript错误 [英] How to resolve the javascript error of CKEditor in IE 11
问题描述
我的asp.net网站使用CKEditor 3.5.3.虽然它在所有其他浏览器上都能正常运行,但在IE 11中会出现以下错误:
My asp.net website uses CKEditor 3.5.3. While it works fine on all other browsers, it gives the following error in IE 11:
JavaScript runtime error: NotSupportedError
N=F.$.createEvent('KeyEvents')
看来,对于IE 11,我们必须使用CKEditor版本4.3.4.我想知道是否只有针对javascript错误的修复程序,因为我现在不想升级.
It appears that for IE 11, we have to use CKEditor version 4.3.4. I am wondering whether there is any fix for just the javascript error, since I don't want to upgrade for now.
除了升级所需的时间外,我主要不愿进行升级,因为最新版本没有旧版本的asp.net应用程序要使用的dll.
My main reluctance for the upgrade, apart from the time involved is that, the latest version doesn't have a dll to be used by asp.net applications which the older versions had.
推荐答案
我遇到了同样的问题,并且我不想升级整个CKE控件,因此我设法通过调整代码中的代码来解决此问题.压缩ckeditor.js来检查IE 11或更高版本.
I had this same exact issue, and I don't want to upgrade the whole CKE control, so I managed to fix the issue by adjusting the code in the compressed ckeditor.js to check for IE 11 or above.
几乎, createEvent('KeyEvents')
对于IE11不再有效,需要将其更改为 createEvent('Events')
.
Pretty much, the createEvent('KeyEvents')
is no longer valid for IE11 and it needs to be changed to createEvent('Events')
.
在调用createEvent之后,将有一个 initKeyEvent('keypress',....)
方法调用,还需要对其进行调整以调用 initEvent('keypress',....)
用于IE11 +.
Following the call to createEvent, there will be an initKeyEvent('keypress', ....)
method call which also needs to be adjusted to call initEvent('keypress', ....)
for IE11+.
在放入必要的条件语句以检测IE11之后(在下面的示例中使用dojo),调整后的CKE JS如下:
After putting in the necessary conditional statements to detect IE11 (using dojo in the example below), the adjusted CKE JS is as follows:
O=G.$.createEvent(dojo.render.html.ie >= 11 ? 'Events' : 'KeyEvents');
if(dojo.render.html.ie >= 11)
O.initEvent('keypress',true,true,F.$,false,false,false,false,0,32);
else
O.initKeyEvent('keypress',true,true,F.$,false,false,false,false,0,32);
上面的JS代码可能与您的不同,但是该示例仍然适用于IE11的合成事件的无效使用.
The above JS code may be different from yours, but the example still applies to the invalid use of the synthetic events for IE11.
这篇关于如何解决IE 11中CKEditor的JavaScript错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!