开发者

Firefox <input type="file" /> calling jquery val throws "NS_ERROR_DOM_SECURITY_ERR"

Calling following code in Firebug console in firefox throws 1000 "NS_ERROR_DOM_SECURITY_ERR" exception, dont know why and how. tried putting code in the开发者_JS百科 file in the server to avoid different domain issue, But that also did not work .

$("input[type='file']").val('c:\temp\pngs\UA_text_logo.png');


For security reasons browsers forbid you from setting the value of an input[type='file'] field. So it's normal that you get this error. You are attempting an unauthorized operation. You can read the filename that has been selected by the user but you cannot set its value.


You can't set value of file input in any browser. In addition you can't invoke click programatically in firefox.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜