[英]IE 8-9 SCRIPT5: Zugriff verweigert (Access Denied) on Submit
我的網頁中有另一個子域提供的iframe。 在這個iframe中,我有一個表格
<div id="main"></div>
<form id="fileForm" method="POST" action="https://othersub.samedomain.de/upload" enctype="multipart/form-data">
<input name="filename" type="file" id="filename"><br>
<input name="action" type="hidden" value="fileupload">
<a href="#" id="file-upload">upload</a>
</form>
在我的JS我有這個:
$(document).ready(function() {
$("#file-upload").click(function(event){
event.preventDefault();
console.log("CLICK EVENT");
$("#fileForm").submit();
});
$("#fileForm").ajaxForm({
'target': '#main',
'dataType': 'json',
'type': 'POST',
'url': 'https://othersub.samedomain.de/upload',
beforeSubmit: function(){
/* show loading */
},
success: function(response, statusText, xhr, $form) {
/* do */
},
error: function(response, statusText, xhr, $form) {
/* do */
}
});
});
所以我點擊我的上傳按鈕,我在IE中變成一個嚴重錯誤:(訪問被拒絕)SCRIPT5
這是這行代碼(554):
submitFn.apply(form);
或者更多:
try {
form.submit();
} catch(err) {
// just in case form has element with name/id of 'submit'
var submitFn = document.createElement('form').submit;
submitFn.apply(form);
}
在舊版IE中,當他不得不使用iframe上傳時,就會發生這種情況。 我希望你能提供幫助。
最好的祝福
輸入文件有一個大問題,在IE上必須單擊該元素,如果您使用一種javascript模擬此單擊,則提交后會出現一個錯誤。 嘗試此操作,將輸入文件的Alpha 0值和篩選器0放在假按鈕上以選擇文件
樣品
START HTML--------------------------------
< form ... >
< input type="file" id="ID_INPUTFILE" ....>
< a href="#" id="FAKE_BUTTON"> CHOSE YOU FILE < /a>
...
< /form >
< /html>
END HTML----------------------------------
START CSS--------------------------------- < style> form { position:relative; } #FAKE_BUTTON { width: 200px; height: 30px; left: 10px; top: 10px; z-index:2; } #ID_INPUTFILE { position: absolute; width: 200px; /*WIDTH_OF_FAKE_BUTTON*/ height: 30px; /*HEIGHT_OF_FAKE_BUTTON*/ left: 10px; /*LEFT_POSITION_OF_FAKE_BUTTON */ top: 10px; /*TOP_POSITION_OF_FAKE_BUTTON */ z-index: 3; /*ALWAY OVER FAKE BUTTON */ opacity: 0.0; /*TO PUT INVISIBLE */ filter: alpha(opacity=0); /*TO PUT INVISIBLE fix ie */ } < /style> END CSS-----------------------------------
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.