Skip to content

PramisKunwar/footprint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

875712fΒ Β·Β Β· Mar 4, 2026

History

8 Commits
Mar 4, 2026
Mar 4, 2026
Mar 4, 2026
Mar 3, 2026
Mar 4, 2026
Mar 4, 2026
Mar 4, 2026

Repository files navigation

CarbonBrowse - Internet Carbon Foot print Tracker

A simple Chrome extension that estimates the carbon footprint of any webpage you visit.

Core Concept

CarbonBrowse estimates COβ‚‚ emissions based on page data transfer size using a simplified formula:

1 MB of data transfer β‰ˆ 0.2 grams of COβ‚‚

This is an educational estimate, not a precise measurement.

Features

  • Page size estimation using the Performance API (with fallback to HTML length)
  • COβ‚‚ calculation displayed in a clean popup
  • Color-coded impact indicator:
    • 🌿 Green β€” Low impact (< 0.1g COβ‚‚β‚‚)
    • 🌀️ Yellow β€” Moderate impact (0.1g – 0.5g COβ‚‚)
    • ⚠️ Red β€” Heavy page (> 0.5g COβ‚‚β‚‚)
  • Eco-friendly message to raise awareness
  • Landing page with installation instructions and extension preview

File Structure

β”œβ”€β”€ footprint/
β”‚       β”œβ”€β”€ manifest.json       # Extension manifest (permissions, scripts)
β”‚       β”œβ”€β”€ content.js          # Injected into pages β€” calculates page size
β”‚       β”œβ”€β”€ popup.html          # Extension popup UI
β”‚       β”œβ”€β”€ popup.css           # Green-themed popup styling
β”‚       └── popup.js            # Popup logic β€” communicates with content.js

.js

How the Extension Works

  1. content.js runs on every webpage and calculates total page size:
    • Uses performance.getEntriesByType("resource") to sum transferSize / encodedBodySize
    • Adds main document size via performance.getEntriesByType("navigation")
    • Falls back to document.documentElement.innerHTML.length if the Performance API returns nothing
  2. popup.js sends a message to content.js, receives the page size in MB, multiplies by 0.2 to get estimated COβ‚‚, and displays the result
  3. popup.html + popup.css render a clean, green-themed card UI

Installation (Chrome Extension)

  1. Download or clone this repository
  2. Open chrome://extensions in Chrome
  3. Enable Developer Mode (top-right toggle)
  4. Click Load unpacked
  5. Select the public/extension folder
  6. Click the CarbonBrowse icon on any webpage to see its carbon footprint

Tech Stack

Layer Technology
Chrome Extension Vanilla JS, Manifest V3

Development (Landing Page)

npm install
npm run devv

License

Built for Hack Club . Use freely.