Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>@Rudie, up here - Thanks for that code! It works great in IE and Chrome, but not in FireFox.</p> <p>I managed to take my old code (That works in FF and Chrome) and combined your code for MSIE.</p> <p>Check it out here:</p> <p><strong>FIX FOR IE, CHROME AND FIREFOX</strong></p> <p><a href="https://gist.github.com/4337047" rel="nofollow noreferrer">https://gist.github.com/4337047</a></p> <p><strong>PROBLEM:</strong> When an file-input is opened via a scripted, forced click() event, IE won't let you submit the form. If you click the file-input via your own mouse (what we don't want), IE will let you submit the form.</p> <p>Please note that IE11, as of now, is allowing the form to submit if a file input field has changed via a scripted 'click' event.</p> <p><strong>Solution</strong> (partly thanks to Rudie @ Stackoverflow, <a href="https://stackoverflow.com/users/247372/rudie">https://stackoverflow.com/users/247372/rudie</a> , <a href="http://hotblocks.nl/" rel="nofollow noreferrer">http://hotblocks.nl/</a>): </p> <p>Make a label for the input in IE. If you click it, it will force a click on the input field - and IE will accept that (dumbass IE thinks user clicked the input field, hah)</p> <p>So in that label we'll put our own styled DIV. </p> <p>Next problem was, this doesn't work in FF. So we made a simple (possible nasty) browser check, and based on the browser we'll show a different button.</p> <p>Solution is right here. Tested in:</p> <ul> <li>Win 7 x64</li> <li>FireFox 13.01</li> <li>Chrome 23.0.1271.97 m</li> <li>IE9 in regular IE9 mode</li> </ul> <p>More tests / additions to code are MORE than welcome!</p> <p><strong>EDIT:</strong></p> <p>To quote <strong>Roy McKenzie</strong></p> <blockquote> <p>IE11 is now allowing the form to submit if a file input field has changed via a scripted 'click' event.</p> </blockquote>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload