Dev.to WebDev 🛠 Dev 👁 0 📖 3 min read

Add a free joke of the day to any website in 2 minutes (no API key, no cookies)

I run GiggleTime, a joke site in 26 languages. We wanted an easy way for anyone to show a daily joke on their own pages: class websites, school newsletters, team dashboards, language-learning blogs. So we made a free wid

I run GiggleTime, a joke site in 26 languages. We wanted an easy way for anyone to show a daily joke on their own pages: class websites, school newsletters, team dashboards, language-learning blogs. So we made a free widget, plus a tiny JSON endpoint for anyone who'd rather build their own.

Here's how to use both.

Option 1: paste an iframe

<iframe src="https://www.giggletime.app/embed/joke?lang=en"
        title="Joke of the Day" width="100%" height="200"
        loading="lazy" style="border:0"></iframe>

That's it. The joke changes once a day, and everyone who opens the page that day sees the same one.

You can add a few parameters:

Parameter Values Default
lang en, es, fr, de, it, pt, nl, pl, ru, uk, ja, zh, ar, hi and 12 more en
cat animals, school, food-and-drink, family, pun, programming, christmas, ... all
theme auto, light, dark auto (follows the visitor's dark mode)
size s (160px), m (200px), l (260px) m

For example, a dark programming joke in Spanish:

<iframe src="https://www.giggletime.app/embed/joke?lang=es&cat=programming&theme=dark"
        title="Chiste del día" width="100%" height="200"
        loading="lazy" style="border:0"></iframe>

The widget page has a configurator with a live preview if you don't want to type URLs.

A few things I cared about when building it:

  • No cookies and no third-party scripts inside the iframe, so it doesn't add anything to your cookie banner.
  • Family-friendly only. Jokes go through a content filter, and only ones rated suitable for all ages are picked. It ends up on classroom screens, so this mattered.
  • Two-part jokes hide the punchline until someone clicks. In a classroom that turns it into a little guessing game.

It works anywhere you can paste HTML: WordPress (Custom HTML block), Google Sites (Insert > Embed > Embed code), Blogger, Wix, Squarespace, Notion (/embed) and plain HTML.

Option 2: fetch the JSON yourself

If you want your own design, there's a keyless, CORS-enabled endpoint:

GET https://www.giggletime.app/embed/today?lang=en
{
  "date": "2026-11-24",
  "lang": "en",
  "labels": { "title": "Joke of the Day", "reveal": "Reveal punchline" },
  "joke": {
    "id": 1440,
    "setup": "What did the tooth brush say to the tube?",
    "punchline": "Give me a squeeze and let's get started!",
    "text": "...",
    "url": "https://www.giggletime.app/en/jokes/jokes/1440/..."
  }
}

labels comes translated into the language you ask for, so you don't need your own translations for the heading and button.

A minimal vanilla JS version:

<div id="joke">
  <strong id="joke-title"></strong>
  <p id="joke-setup"></p>
  <button id="joke-reveal" hidden></button>
  <p id="joke-punchline" hidden></p>
</div>
<script>
fetch('https://www.giggletime.app/embed/today?lang=en')
  .then(r => r.json())
  .then(({ labels, joke }) => {
    if (!joke) return;
    document.getElementById('joke-title').textContent = labels.title;
    const setup = document.getElementById('joke-setup');
    const punchline = document.getElementById('joke-punchline');
    const button = document.getElementById('joke-reveal');
    if (joke.punchline) {
      setup.textContent = joke.setup;
      punchline.textContent = joke.punchline;
      button.textContent = labels.reveal;
      button.hidden = false;
      button.onclick = () => { punchline.hidden = false; button.hidden = true; };
    } else {
      setup.textContent = joke.text;
    }
  });
</script>

Please keep a small "Joke of the day by GiggleTime" link somewhere near it. That's the only thing we ask.

WordPress?

There's also a plugin with a block, a sidebar widget and a [giggletime_joke] shortcode (link to come once it's approved on wordpress.org).

If you use it somewhere, I'd love to see where. And if a language you need is missing, tell me in the comments.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.