惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
月光博客
月光博客
IT之家
IT之家
B
Blog RSS Feed
T
Tailwind CSS Blog
The GitHub Blog
The GitHub Blog
博客园 - 三生石上(FineUI控件)
MyScale Blog
MyScale Blog
J
Java Code Geeks
Stack Overflow Blog
Stack Overflow Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - Franky
博客园 - 叶小钗
阮一峰的网络日志
阮一峰的网络日志
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
U
Unit 42
博客园_首页
B
Blog
V
V2EX
腾讯CDC
Vercel News
Vercel News
量子位
Microsoft Security Blog
Microsoft Security Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
I Built a Firefox New Tab Extension with Zero Dependencie...
Weather Cloc · 2026-05-04 · via DEV Community

Weather Clock Dash

Replacing your Firefox new tab page is surprisingly powerful — you see it dozens of times a day. Here's how I built a dashboard that actually earns that real estate.

What I Built

Weather & Clock Dashboard is a Firefox new tab extension that shows:

  • Live weather with current conditions and 3-day forecast
  • World clocks for multiple time zones
  • Search bar (supports DuckDuckGo, Google, Bing)
  • Clean dark/light mode

The Technical Stack (or Lack Thereof)

The entire extension is a single newtab.html file. No npm, no webpack, no build step. Just vanilla HTML, CSS, and JavaScript.

<!-- manifest.json -->
{
  "manifest_version": 3,
  "name": "Weather & Clock Dashboard",
  "chrome_url_overrides": {
    "newtab": "newtab.html"
  },
  "permissions": ["storage"]
}

Enter fullscreen mode Exit fullscreen mode

That's it. The extension replaces Firefox's new tab with your custom page.

Getting Weather Data Without an API Key

Most weather APIs require signup and have rate limits. I used Open-Meteo — a free, open-source weather API that requires zero authentication:

const response = await fetch(
  `https://api.open-meteo.com/v1/forecast?latitude=${lat}&longitude=${lon}&current_weather=true&daily=weathercode,temperature_2m_max,temperature_2m_min&timezone=auto`
);
const data = await response.json();

Enter fullscreen mode Exit fullscreen mode

The API returns current conditions plus a 3-day forecast. No API key, no rate limits for reasonable personal use.

Geolocation in a New Tab Extension

Browser extensions can use the Geolocation API just like websites. But there's a catch: newtab pages don't automatically get location permission.

The workaround: store coordinates in browser.storage.local after first prompt, then reuse them:

navigator.geolocation.getCurrentPosition(async (pos) => {
  const { latitude, longitude } = pos.coords;
  await browser.storage.local.set({ lat: latitude, lon: longitude });
  // now fetch weather...
});

Enter fullscreen mode Exit fullscreen mode

Users see the permission prompt once. After that, the new tab loads weather data instantly.

World Clocks

For world clocks, JavaScript's Intl.DateTimeFormat handles timezone conversions natively:

function getTimeInZone(timezone) {
  return new Intl.DateTimeFormat('en-US', {
    timeZone: timezone,
    hour: '2-digit',
    minute: '2-digit',
    hour12: true
  }).format(new Date());
}

Enter fullscreen mode Exit fullscreen mode

No external library needed. Users can pick from any IANA timezone.

Dark Mode Without a Framework

Just CSS custom properties + a class toggle:

:root {
  --bg: #ffffff;
  --text: #1a1a1a;
}

[data-theme="dark"] {
  --bg: #1a1a2e;
  --text: #e0e0e0;
}

Enter fullscreen mode Exit fullscreen mode

const saved = localStorage.getItem('theme') || 'light';
document.documentElement.setAttribute('data-theme', saved);

Enter fullscreen mode Exit fullscreen mode

No React state, no styled-components, no Tailwind. Just CSS doing what CSS was made for.

What I Learned

  1. Browser extensions are simpler than you think — Manifest V3 is well-documented and Firefox's AMO review process is thorough but fair
  2. Zero dependencies is a feature — The extension loads in under 100ms because there's nothing to parse
  3. Open APIs are underrated — Open-Meteo lets you build real weather features without a credit card

Install It

The extension is free, open source (MIT), and available on Mozilla Add-ons.

If you've been thinking about building a browser extension, this is honestly a great project to start with. The scope is small enough to ship in a weekend, but the result is something you'll see every single day.


Follow @weatherclockdash on Mastodon for updates.