SCRIPT5: Access denied
jquery.min.js, line 3 char 3769
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();
});
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">
submit input doesn't help
I dont get it cuz if i try to send another form that works fine
i have found an other way to do this ... I have make test and i found it work after 2 or 3 click on the submit button.
i have try some solution but found this by my self. this is only for ie.
note i dont use the jquery submit method because they handle the error.
ps. sorry for my bad english, this is not my first language.
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
More details here https://github.com/valums/file-uploader/issues/118#issuecomment-1387612
You can try styling the input type file though http://www.quirksmode.org/dom/inputfile.html
I had similar HTML and jQuery code and encountered the same issue (i.e. 'Access is denied.' JavaScript error in Internet Explorer), which I managed to resolve by taking pointers from this (great) answer.
In your instance:
Change the #icon_upl
<button>
/<input>
to a<label>
and make use of the tag's accessibility features by setting thefor
attribute on it to point to your<input name="icon" type="file">
element.This effectively makes your
click()
event handler redundant. However, clicking the<label>
in Firefox does not seem to trigger the file<input>
dialog so you'll need to perform a browser test and still have theclick()
event handler if the browser is Mozilla-based.In order for it to work, you'll need to make sure that your file
<input>
is not hidden by setting its position to be absolute and moving it off-screen.You can make a direct event firing on hidden input field because you can't catch it. It is possible to bind event with it and trigger it via another.
for example:
Note: But its not clear from your post that if you have already something like this or not.
It seems to be impossible
from getting access is denied error on IE8