Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

140
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda