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

162
Views
Fetch other web page and get async content

In my Greasemonkey script I'm fetching some other web page and using the response in my code. However when I do this, it only gets the initial HTML content. If some of the content is async (which loads later) then I can't see that content in the response.

My researchs told me to use "waitForKeyElements", but it only work if the current url = the fetching page. It doesn't work when I fetch data from another web page.

If there is something I can do for my needs (not necessarily DOMParser), please tell me.

Here is my code:

// this script runs when I'm in google.com

GM_xmlhttpRequest({
    url : "https://www.example.com",
    method : "GET",
    timeout: 10000,
    onload : function(response) {
        if (response.status == 200) {

            const parser = new DOMParser();
            const result = parser.parseFromString(response.responseText, "text/html").body; 
 
            let div = result.querySelector(".some-selector-here") 
            // returns null because this is async content


        } else {
            console.log(" Error: HTTP " +response.status+ " Error.");
        }
    },

});
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!