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

135
Visualizações
Javascript async functions doesn't work in android chrome from js in url bar

I made a simple script to run in my android chrome. It comes that there are 2 scenarios working differently:

first one javascript:(alert("try")) works with no problems

second one javascript:(async function test(){alert("try")};test()) does NOT work

obv it's not what i am trying to do but in my desired script i need an await or a generic sleep. What can i do?

edit: the curious thing is that setInterval works fine... but javascript:(let prova = "try";alert(prova)) doesn't work

edit2: i did it, it took a very bad headache but now works. There are things that doesn't work for some reason but a workaround can always be found

here's what's the final working version

javascript:(setInterval(() =>{setTimeout(() => {document.querySelector('.nameofthetextareaselector').value="value i wanted to put here";document.querySelector('.nameofthebuttontosend').click();new Promise(resolve => setTimeout(() => {document.querySelector('.nameofthesecondbutton').click()},2000));resolve},2000)},5000))

It edits the textarea, send it, click another button after some seconds and repeat

things that not worked: assign anything with let, const or directly the name of the variable, nesting promises, using async-await, using try-catch, etc...

Now i am happy that all works but i want to know why all these things doesn't seem to work (only on android chrome, on windows chrome all these things worked)

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

What you are doing right now is just declaring a function without calling it, you can add () at the end of javascript function to execute it right away.

javascript:(async function test(){alert("try")}())

about 4 years ago · Juan Pablo Isaza Relatório
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