I have a form containing an input file field [<input type="file" id="select-file" accept=".md"><label for="select-file">Select import file</label>
]. It has defined a jQuery handler for the change event [$("#form").on("change", "#select-file", handler)
] to fire as soon as I selected a file.
It works flawlessly on Linux with Firefox at work and at home with Windows using Firefox and Chrome.
Instead at work with Windows using Chrome or Firefox, the browser freeze for about 8 sec after selecting the file. Only after this hiatus I can push other buttons on the form and the "change" event fires.
Discarding the hypothesis that Windows and work does not mesh, the freeze seems related to the different network disks available at work. Can anyone suggest what I have to check and hopefully a way to avoid the freeze? Thanks!
Small example:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>File Select</title>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
</head>
<body>
<div id="import-form">
<input type="file" id="select-file" accept=".md">
<label for="select-file">Select a file</label>
<p id="selected-file">No file selected</p>
</div>
<script>
$("#import-form").on("change", "#select-file", function(e) {
$("#selected-file").text(e.target.value.split('\\').pop());
});
</script>
</body>
</html>
Chrome freezes for few seconds when after any use of file field.
It was because I had a shortcut in "Quick Access" menu in windows explorer. This shortcut has been linked with a folder shared by network. I've removed this shortcut and everything is good now.
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