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

211
Vistas
Cómo obtener todos los favicon del sitio, por url

Aquí está mi analizador:

 let getFavicon = function () { let favicons = []; let nodeList = document.getElementsByTagName('link'); for (let i = 0; i < nodeList.length; i++) { if ( nodeList[i].getAttribute('rel') === 'icon' || nodeList[i].getAttribute('rel') === 'shortcut icon' ) { favicons.push(nodeList[i].getAttribute('href')); } } return favicons; };

Devuelve una matriz de URL, con todos los favicons de URL.

¿Cómo puede el usuario obtener estos favicons? al ingresar la URL en la entrada y obtener los favicons.

Al igual que las etiquetas de Google, ingresamos la URL y obtenemos las etiquetas con el favicon

ingrese la descripción de la imagen aquí

ingrese la descripción de la imagen aquí

¿Cómo puedo hacer lo mismo?

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

0

Espero que este ejemplo ayude:

 let favicons = []; let nodeList = document.getElementsByTagName("link"); for (let i = 0; i < nodeList.length; i++) { if ((nodeList[i].getAttribute("rel") === "icon") || (nodeList[i].getAttribute("rel") === "shortcut icon")) { favicons.push(nodeList[i].getAttribute("href")) } } function searchStringInArray (str, strArray) { for (var j=0; j<strArray.length; j++) { if (strArray[j].match(str)) return strArray[j]; } return -1; } const searchTextBox = document.querySelector('input[name="search"]') searchTextBox.addEventListener('keyup', (e) => { const searchResult = searchStringInArray(e.target.value, favicons) if(searchResult != -1){ document.querySelector('.icon').style.background = `url('${searchResult}')` } })
 .icon { height: 35px; width: 35px; display: block; }
 <head> <link rel="shortcut icon" href="https://abs.twimg.com/favicons/twitter-pip.ico" type="image/x-icon"> <link rel="icon" href="https://www.youtube.com/s/desktop/6e57b52d/img/favicon_48x48.png" sizes="48x48"> <link rel="shortcut icon" href="https://cdn.sstatic.net/Sites/stackoverflow/Img/favicon.ico?v=ec617d715196"> </head> <input name="search" type="text"> <span class='icon'></span>

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