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

206
Views
How to prevent redirect with autoclick in javascript?

I have this issue where if I click do a manual click of a button using my mouse, the browser will load the next page with an iframe with the appropriate URL. However if I use an autoclick (like .click()) then it will load the next page then continue to redirect and load the iframe URL in the top frame.

I noticed that the manual click actually has chrome blocking the redirect while the autoclick does not have chrome blocking the redirect. How does chrome know if I clicked with my mouse vs using .click()? And is there a way to imitate the manual mouse click? Or to prevent the redirect using javascript? I was thinking trying to wait until the next page loads then doing preventDefault() or something like that.

Also worth noting that I don't own the website code. I'm working on a program that overlays on top of the site I'm on so I kind of have to work around changing html.

Edit: adding code for visual. first chunk is the website code im working with.

<a target="_self" href="iframeUrl">
   <img border="0" src="/imageURL">
</a>

Using $0.click() is what I'm doing but it keeps redirecting when I get to the next page.

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!