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

190
Visualizações
How to check if the URL of other domains exists using javascript?

I am trying to check wheater the URL of another domain exists or not from my domain('https://radiusofficefurniture.ie') using Javascript like :

var request = new XMLHttpRequest();  
request.open('GET', 'https://www.mozilla.org', true);
request.onreadystatechange = function(){
    if (request.readyState === 4){
        if (request.status === 404) {  
            alert("Oh no, it does not exist!");
        }  
    }
};
request.send();

But the issue of CORS policy occurred. The error is like this:

Access to XMLHttpRequest at 'https://www.mozilla.org/' from origin 'https://radiusofficefurniture.ie' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Kindly someone help me how can I check if the URL of other domains exists using javascript? Actually, I have to add an HTML tag to my site if the URL of other domains exists.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The easiest way is to use a CORS Proxy (if you want to avoid any extra code). You can find a couple here, and they're all relatively easy to set up.

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