开发者

IE's execCommand not working when inserting image

I am using nicedit WYWIWYG editor and all is well in the land of the good web browser but once again MS has cause me frustration through its IE incarnation!

For some reason this command

document.execCommand(cmd,false,args);

is returning false unlike all other browsers, therefore not executin开发者_如何学编程g properly

These are my params:

    cmd "insertImage"   String
    args    "javascript:nicImTemp();"   String

Anyone shed any light? I've ensured that the "allow scripting of Microsoft web browser control" is enabled in the security settings

Thanks


As an XSS-attack-surface-reduction, Internet Explorer 6 and later do not permit a "javascript:" URL as the source of an IMG tag. Specify a HTTP/HTTPS/FILE URI instead and your code should work.


In IE8 you have to put focus() on your editing area first.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜