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
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 the for
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 the click()
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With