Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

761
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda