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

103
Vistas
Fetch is getting local and input url

Im trying to get from urlData the url to use on my fetch. But im getting an error, my fetch is getting the local and input url

function analyzeWebSite() {
  const urlData = document.getElementById('url_data');
  const url = urlData.value;
  if (url === '') {
    alert('You need to send a valid website.');
    return;
  }
  fetch(url).then(function (response) {
    console.log(response); // show all response from the sended webpage
    return response.text().then(function (text) {
      console.log(text); // show all the text from the sended webpage
    });
  });
}

enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The console error says 404 not found. I think you need to make sure the user adds https or http in the input.

Alternatively, you can modify the user's input:

if(!url.match(/https?:\/\//)){
  url = "https://" + url;
}
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