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

192
Views
How do you write Javascript to open page and then click on button on page in one go

I would like to open a particular webpage and then click on a button to open another page from that page. Now I can see how to write Javascript to find a button on page and click on it, what I dont quite understand how I can do that from the 1st page.

i.e on Page 1 can open Page 2, but how do I in one go from page 1 get it to click on a button on page 2 once page 2 is loaded because until Page 2 is loaded the button is not available, and if I just go to Page 2 my Javascript will not be running because that was on Page 1 ?

What I am trying to do is a poweruser feature that makes it easier to do a particular repetitive task, I am the sys adminstator for page 1 but not page 2.

This is example of the page Im trying to do this for

https://acoustid.org/track/61c9656b-6838-4660-8113-86f7f90fd549

You need to login to Acoustid to actually see the Disable buttons

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Open new browser window with js (modal or tab)

var newWindow = window.open("http://www.....com");

Add onload handler for new window and insert script (optionally)

newWindow.addEventListener("DOMContentLoaded", Func);

function Func()
{
    var script = newWindow.document.createElement("script");
    script.text = "alert('hello');";
    newWindow.document.body.appendChild(script);
}

Insert js code straightforwardly if you don't need to handle load

Func();
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!