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

132
Views
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 answers
Answer question

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 Report
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!