cdnjs de Cloudflare: Qué es y por qué es clave en la web actual

Valencia, 28/10/2026, G.B.
Cuando visitas una página web moderna, es habitual que cargue bibliotecas de código reutilizable (como fuentes, iconos o librerías de utilidades JavaScript y CSS). En lugar de alojar todos esos archivos pesados directamente en el servidor propio, muchos desarrolladores recurren a un servicio CDN gratuito y ultrarrápido como cdnjs.

Qué es cdnjs

cdnjs es uno de los repositorios de código libre (open-source) más populares del mundo. Sirve como una red de distribución de contenidos (CDN) orientada a ofrecer archivos JavaScript, CSS, fuentes y bibliotecas web de forma totalmente gratuita, segura y optimizada.

Desde que pasó a estar respaldado e impulsado por la infraestructura global de Cloudflare, cdnjs.cloudflare.com distribuye miles de librerías a millones de páginas web con una latencia mínima y máxima disponibilidad.

Ventajas principales

  • Velocidad de carga global: Gracias a la red CDN de Cloudflare, los archivos se sirven desde el servidor más cercano geográficamente al visitante
  • Ahorro de ancho de banda: Evita sobrecargar el servidor principal de tu sitio web descargando la entrega de librerías estáticas comunes
  • Caché compartida: Si el navegador de un usuario ya ha descargado una librería desde cdnjs en otra web, la reutilizará al instante sin necesidad de volver a descargarla
  • Seguridad y disponibilidad: Cuenta con alta disponibilidad, certificado SSL/TLS integrado y soporte para comprobaciones de integridad (SRI – Subresource Integrity)

Ejemplo práctico de uso

Integrar una librería mediante cdnjs es tan sencillo como incluir el enlace directo en la cabecera HTML de tu página o plugin:

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" />

El enfoque de Indaga.net

Aunque servicios como cdnjs ofrecen un rendimiento excepcional para proyectos generales, en Indaga.net prefiero siempre (que se pueda) el desarrollo nativo, minimizando las dependencias externas y las llamadas a servidores de terceros para lograr el máximo nivel de privacidad, ligereza y velocidad de carga.

Script para cargar frases aleatorias como gadget en Blogger

Valencia, 28/08/2026, G.B.
Un script para cargar 50 frases de forma aleatoria en un gadget de Blogger. En breve estará disponible como plugin para WordPress con la misma función.

Aquí dejo el código con las instrucciones para insertarlo como gadget de Blogger. Yo lo he llamado «Some Thoughts…». Incluye 50 frases (en inglés, eso sí). El ejemplo en Blogger puedes verlo aquí y también en WordPress como un widget el pie de página de esta misma web. Repito, habrá un plugin para WordPress que incluya administración de las frases o «pensamientos».

Sin más, este es el código:

<!-- 
GADGET DE FRASES ALEATORIAS PARA BLOGGER
Cómo instalarlo:
1. En el panel de Blogger, ve a Diseño > Añadir un gadget.
2. Elige "HTML/JavaScript".
3. Pega todo este código en el cuadro de contenido.
4. Guarda.
-->

<div id="frase-widget" style="font-family: Georgia, serif; padding: 16px; border-left: 4px solid #444; background: #f9f9f9; max-width: 100%; box-sizing: border-box;">
<p id="frase-texto" style="font-style: italic; font-size: 16px; line-height: 1.5; margin: 0 0 8px 0;"></p>

<p id="frase-autor" style="text-align: right; font-weight: bold; margin: 0 0 12px 0;"></p>

<button id="frase-btn" style="cursor: pointer; padding: 6px 14px; border: none; border-radius: 4px; background: #444; color: #fff; font-size: 14px;">
Otra frase
</button>
</div>

<script>
(function() {
var frases = [
{
texto: "He who blames others has a long way to go on his journey. He who blames himself is halfway there. He who blames no one has arrived.",
autor: "Chinese Proverb"
},
{
texto: "The only way to do great work is to love what you do.",
autor: "Steve Jobs"
},
{
texto: "In the middle of difficulty lies opportunity.",
autor: "Albert Einstein"
},
{
texto: "It does not matter how slowly you go as long as you do not stop.",
autor: "Confucius"
},
{
texto: "Fall seven times, stand up eight.",
autor: "Japanese Proverb"
},
{
texto: "The journey of a thousand miles begins with a single step.",
autor: "Lao Tzu"
},
{
texto: "Whether you think you can or you think you can't, you're right.",
autor: "Henry Ford"
},
{
texto: "The best way to predict the future is to create it.",
autor: "Abraham Lincoln"
},
{
texto: "Success is not final, failure is not fatal: it is the courage to continue that counts.",
autor: "Winston Churchill"
},
{
texto: "Believe you can and you're halfway there.",
autor: "Theodore Roosevelt"
},
{
texto: "Do not go where the path may lead, go instead where there is no path and leave a trail.",
autor: "Ralph Waldo Emerson"
},
{
texto: "The mind is everything. What you think you become.",
autor: "Buddha"
},
{
texto: "Water which is too pure has no fish.",
autor: "Chinese Proverb"
},
{
texto: "A smooth sea never made a skilled sailor.",
autor: "African Proverb"
},
{
texto: "He that can have patience can have what he will.",
autor: "Benjamin Franklin"
},
{
texto: "You miss 100% of the shots you don't take.",
autor: "Wayne Gretzky"
},
{
texto: "Life is what happens when you're busy making other plans.",
autor: "John Lennon"
},
{
texto: "The only impossible journey is the one you never begin.",
autor: "Tony Robbins"
},
{
texto: "Not all those who wander are lost.",
autor: "J.R.R. Tolkien"
},
{
texto: "It always seems impossible until it's done.",
autor: "Nelson Mandela"
},
{
texto: "Do what you can, with what you have, where you are.",
autor: "Theodore Roosevelt"
},
{
texto: "If you want to go fast, go alone. If you want to go far, go together.",
autor: "African Proverb"
},
{
texto: "The best time to plant a tree was 20 years ago. The second best time is now.",
autor: "Chinese Proverb"
},
{
texto: "What lies behind us and what lies before us are tiny matters compared to what lies within us.",
autor: "Ralph Waldo Emerson"
},
{
texto: "Turn your wounds into wisdom.",
autor: "Oprah Winfrey"
},
{
texto: "Knowing yourself is the beginning of all wisdom.",
autor: "Aristotle"
},
{
texto: "The unexamined life is not worth living.",
autor: "Socrates"
},
{
texto: "He who has a why to live can bear almost any how.",
autor: "Friedrich Nietzsche"
},
{
texto: "Out of difficulties grow miracles.",
autor: "Jean de La Bruyère"
},
{
texto: "A journey of a thousand miles must begin with a single step.",
autor: "Lao Tzu"
},
{
texto: "Even a small star shines in the darkness.",
autor: "Finnish Proverb"
},
{
texto: "The bamboo that bends is stronger than the oak that resists.",
autor: "Japanese Proverb"
},
{
texto: "Better to light a candle than curse the darkness.",
autor: "Chinese Proverb"
},
{
texto: "When the winds of change blow, some build walls, others build windmills.",
autor: "Chinese Proverb"
},
{
texto: "Fall down seven times, get up eight.",
autor: "Japanese Proverb"
},
{
texto: "One who plants a tree knows they will not sit in its shade.",
autor: "Indian Proverb"
},
{
texto: "The nail that sticks out gets hammered down.",
autor: "Japanese Proverb"
},
{
texto: "A single arrow is easily broken, but not ten in a bundle.",
autor: "Japanese Proverb"
},
{
texto: "He who has never failed has never tried anything new.",
autor: "African Proverb"
},
{
texto: "Even the greatest of trees was once a nut who held its ground.",
autor: "American Proverb"
},
{
texto: "The river that forgets its source will dry up.",
autor: "African Proverb"
},
{
texto: "A bird does not sing because it has an answer, it sings because it has a song.",
autor: "Chinese Proverb"
},
{
texto: "Patience is bitter, but its fruit is sweet.",
autor: "Aristotle"
},
{
texto: "He who is not courageous enough to take risks will accomplish nothing in life.",
autor: "Muhammad Ali"
},
{
texto: "The best preparation for tomorrow is doing your best today.",
autor: "H. Jackson Brown Jr."
},
{
texto: "Success usually comes to those who are too busy to be looking for it.",
autor: "Henry David Thoreau"
},
{
texto: "Do not wait for the perfect moment, take the moment and make it perfect.",
autor: "Unknown"
},
{
texto: "Great things are done by a series of small things brought together.",
autor: "Vincent van Gogh"
},
{
texto: "Perseverance is not a long race; it is many short races one after the other.",
autor: "Walter Elliot"
},
{
texto: "You cannot cross the sea merely by standing and staring at the water.",
autor: "Rabindranath Tagore"
}
];

function mostrarFraseAleatoria() {
var indice = Math.floor(Math.random() * frases.length);
var frase = frases[indice];

// Comillas dobles normales
document.getElementById('frase-texto').textContent =
'"' + frase.texto + '"';

// Guion normal en lugar del guion largo
document.getElementById('frase-autor').textContent =
'- ' + frase.autor;
}

document
.getElementById('frase-btn')
.addEventListener('click', mostrarFraseAleatoria);

mostrarFraseAleatoria();
})();
</script>

Lenguaje Javascript: Documentación sobre programación web – Javascript en español – Lenguaje JS

javascript

javascriptRecurso online para aprender el popular y útil lenguaje de programación: «Documentación sobre Javascript, su evolución y las mejores herramientas y recursos alrededor de su ecosistema«. «Javascript es un lenguaje de programación, o lo que es lo mismo, un mecanismo con el que podemos decirle a nuestro navegador que tareas debe realizar, en que orden y cuantas veces«…

https://lenguajejs.com/javascript/

Manual de JavaScript de desarrolloweb.com

manual-javascriptUn completo manual del popular lenguaje de script: JavaScript, actualizado a noviembre de 2021. «Actualizamos el Manual de Javascript publicando un nuevo artículo sobre cómo funciona el intérprete del lenguaje y el contexto de ejecución de las funciones, el hosting y otros aspectos que debes entender para dominar Javascript. Además hemos actualizado la descarga del manual con este nuevo contenido. Ahora son 150 páginas… todo un libro para aprender Javascript!«.

https://desarrolloweb.com/manuales/manual-javascript.html

Josh W Comeu

joshwcomeu

joshwcomeuBlog (en inglés) de Josh W Comeu con interesante tutoriales sobre JavaScript, Twitter, React, CSS, Gastby… » My goal with this blog is to create helpful content for front-end web devs, and my newsletter is no different! It includes to upcoming posts and access to special bonus goodies. No spam, unsubscribe at any time.»

https://joshwcomeau.com/