表单提交 - IE访问被拒绝 - 相同的域名 [英] form submit - IE access denied - same domain

查看:103
本文介绍了表单提交 - IE访问被拒绝 - 相同的域名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SCRIPT5: Access denied 
jquery.min.js, line 3 char 3769

我收到此错误的简单表单仅在IE中提交

I'm getting this error by simple form submit only in IE

 $("#icon_upl").click(function(){ //icon_upl is button which open dialog
  $("[name=icon]").click();
});


$("[name=icon]").change(function() { //icon is hidden file input
  $("[name=upload_icon]").submit();  
});

我将该表单发送到位于同一域的隐藏iframe。

I sending that form to hidden iframe which is at the same domain.

<iframe id="upload_target" name="upload_target" src="#" style="width:0;height:0;display:none;"></iframe>
<form name="upload_icon" action="upload_icon.php" method="post" enctype="multipart/form-data" target="upload_target">

提交输入无效

如果我尝试发送另一个工作正常的表格,我不会得到它

I dont get it cuz if i try to send another form that works fine

推荐答案

如果你通过JS触发选择文件对话框然后,在提交表单时,您将收到拒绝访问错误。 IE不允许这样做。您将不得不要求用户直接点击输入类型文件

If you are triggering the select files dialog via JS then you will get an access denied error when submitting the form. IE does not allow this. You will have to ask user to click on input type file directly

此处更多详情
https://github.com/valums/file-uploader/issues/118#issuecomment-1387612

您可以通过
http://www.quirksmode.org/dom/尝试设置输入类型文件的样式inputfile.html

这篇关于表单提交 - IE访问被拒绝 - 相同的域名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆