context-search

Context Search

A browser extension that lets you select any word or phrase on a webpage and instantly get an AI-powered explanation of its meaning — both in the specific context of the page and as a general definition.

Features

•⁠ ⁠Select & Search: Highlight any word or phrase, click the floating icon, and get an instant AI-powered definition •⁠ ⁠Context-Aware: Explains what the word means in the specific context of the webpage you’re reading •⁠ ⁠Multi-Provider: Supports Google Gemini, OpenAI, Anthropic Claude, and Groq — bring your own API key •⁠ ⁠Dark Mode: Automatically matches your system theme •⁠ ⁠Privacy-First: No data collection, no telemetry, no server-side component. Your API key stays in your browser •⁠ ⁠Cross-Browser: Works on Chrome, Edge, and Firefox

Installation

Chrome / Edge (from source)

1.⁠ ⁠Clone or download this repository 2.⁠ ⁠Open ⁠ chrome://extensions/ ⁠ (Chrome) or ⁠ edge://extensions/ ⁠ (Edge) 3.⁠ ⁠Enable Developer mode (toggle in the top-right) 4.⁠ ⁠Click Load unpacked and select the project folder 5.⁠ ⁠Click the extension icon and go to Open Settings to configure your AI provider

Firefox (from source)

1.⁠ ⁠Open ⁠ about:debugging#/runtime/this-firefox ⁠ 2.⁠ ⁠Click Load Temporary Add-on 3.⁠ ⁠Select the ⁠ manifest.firefox.json ⁠ file (or build first — see below)

Building release packages

⁠ bash ./build.sh  ⁠

This creates ⁠ dist/context-search-chrome.zip ⁠ and ⁠ dist/context-search-firefox.zip ⁠.

Setup

1.⁠ ⁠After installing, click the Context Search icon in your browser toolbar 2.⁠ ⁠Click Open Settings 3.⁠ ⁠Choose your AI provider:

Usage

1.⁠ ⁠On any webpage, select a word or phrase by highlighting it 2.⁠ ⁠A small magnifying glass icon appears above your selection 3.⁠ ⁠Click the icon 4.⁠ ⁠A popup appears showing:

Privacy & Security

•⁠ ⁠API keys are stored locally on your device via ⁠ chrome.storage.local ⁠ — they never sync to the cloud and never leave the background service worker •⁠ ⁠The only permission required is ⁠ storage ⁠; host permissions are scoped to the four AI provider API domains •⁠ ⁠Selected text is sent only to your chosen AI provider — no intermediary servers •⁠ ⁠The extension uses a closed Shadow DOM to isolate its UI from host pages •⁠ ⁠All LLM responses are rendered using safe DOM APIs (⁠ textContent ⁠) — never ⁠ innerHTML ⁠ •⁠ ⁠Provider and model settings are validated against a whitelist before every API call •⁠ ⁠Input is sanitized and length-capped (500 chars for selection, 1,500 for context) to mitigate prompt injection •⁠ ⁠Client-side rate limiting (10 requests/minute) protects against accidental overuse •⁠ ⁠The content script only runs on ⁠ http:// ⁠ and ⁠ https:// ⁠ pages — it skips ⁠ file:// ⁠, ⁠ chrome:// ⁠, and other internal URLs

Project Structure

ai-context-search/ ├── manifest.json # Chrome/Edge Manifest V3 ├── manifest.firefox.json # Firefox Manifest V3 ├── build.sh # Packaging script ├── background/ │ └── service-worker.js # API calls and message handling ├── content/ │ ├── content.js # Selection detection, floating icon, popup │ └── content.css # Host element styles ├── popup/ │ ├── popup.html/js/css # Toolbar popup (quick toggle) ├── options/ │ ├── options.html/js/css # Full settings page ├── lib/ │ └── providers.js # LLM provider abstraction ├── icons/ │ └── icon{16,48,128}.png # Extension icons └── store/ ├── privacy-policy.html # Hosted privacy policy for store listing └── listing.md # Chrome Web Store description

License

MIT