Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

750
Views
Simulate / bypass the following: File chooser dialog can only be shown with a user activation

I know this message is telling me the problem... but I'm just messing around with a small fun project and would like to remove the extra click that's required to open a file input when the page loads.

The following (and jsfiddle https://jsfiddle.net/qu52ksef/)

<label id="foo" for="input">Open</label>
<input id="input" name="input" type="file">

<script>
    ready(function() {
        document.querySelector("#foo").click();
    });

    function ready(fn) {
        if (document.readyState != 'loading'){
                fn();
        } else {
            document.addEventListener('DOMContentLoaded', fn);
        }
    }
</script>

This will fire the following in Chrome: File chooser dialog can only be shown with a user activation.

Is there anyway to by pass this check as a sort of 'hack'?. This won't be going into production just a little pet project I'm playing with.

Thanks,

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!