Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

139
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda