javascript - IE 8-9 SCRIPT5: Zugriff verweigert (Access Denied) on Submit -
i have iframe in page sub domain. in iframe have form
<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> in js have this:
$(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) { /* */ }, error: function(response, statustext, xhr, $form) { /* */ } }); }); so click on upload button , become bad error in ie: (access denied) script5
that line (554) of code:
submitfn.apply(form); or more:
try { form.submit(); } catch(err) { // in case form has element name/id of 'submit' var submitfn = document.createelement('form').submit; submitfn.apply(form); } this happends in old ie when has use iframe upload. hope u can help.
best regards
has 1 big problem input file, on ie necessary click on element, if use 1 javascript simulate click, got 1 error after submit. try this, put input file alpha 0 , filter 0 on fake button chose file
sample
start html-------------------------------- < form ... > < input type="file" id="id_inputfile" ....> < href="#" id="fake_button"> chose 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 on fake button */ opacity: 0.0; /*to put invisible */ filter: alpha(opacity=0); /*to put invisible fix ie */ } < /style> end css-----------------------------------
Comments
Post a Comment