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

141
Views
Given a URL how do I receive the document object from it?

I am performing xpath in the browser with document.evaluate(xpath, document, ..). But now I retrieve some URLS from the page and want to perform document.evaluate(xpath, document, ..) on them too without opening the URL in the browser itself or leaving the current page

Is it even possible to do this? It seems like it's not possible to perform something like markup.evaluate(xpath, document, ..) if I manage to retrieve the markup of a URL. Can I retrieve the document of a URL?

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

0

... and want to perform document.evaluate(xpath, document, ..) on them too without opening the URL in the browser itself or leaving the current page

Is it even possible to do this?

Probably not. It's possible only if either A) The URLs are from the same origin as the page you're doing this on, or B) The server(s) for the origin(s) the URLs are on passlist the origin of your page with CORS, relaxing the Same Origin Policy for your origin.

If one of those things is true, though, you can do it by using ajax (e.g., fetch) to fetch the content from the URL and DOMParser to parse it into a document, which you can then query.

But again, if neither of those things is true, you can't do this from browser-hosted JavaScript. You could from Node.js or simlar.

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!