Prerequisites
Knowledge Tooltip is built with vanilla JavaScript and requires no build tools or dependencies. All you need is:- A Chromium-based browser (Chrome, Edge, Brave, Opera, or Vivaldi)
- A text editor or IDE
- Git for version control
This extension uses Manifest V3, Chrome’s latest extension platform. It works on all modern Chromium browsers.
Installation
Open Chrome Extensions
Navigate to your browser’s extensions page:
- Chrome:
chrome://extensions/ - Edge:
edge://extensions/ - Brave:
brave://extensions/
Enable Developer Mode
Toggle the Developer mode switch in the top right corner of the extensions page.
Developer mode allows you to load unpacked extensions and see detailed error messages.
Load the Extension
Click the Load unpacked button and select the project folder you cloned.The extension icon should appear in your browser toolbar.
Development Workflow
Making Changes
Edit any file in the project using your preferred text editor. The extension files are:manifest.json- Extension configurationbackground.js- Service worker for API callscontent.js- Content script (UI and events)popup.html/popup.js- Settings popupstyles.css- All extension styles
Reloading the Extension
After making changes, you need to reload the extension:What Requires Reloading
| File Changed | Reload Extension | Refresh Webpage |
|---|---|---|
manifest.json | Yes | Yes |
background.js | Yes | No |
content.js | Yes | Yes |
styles.css | Yes | Yes |
popup.html / popup.js | Yes | No |
The popup UI can be tested by closing and reopening it without reloading the extension, but it’s best practice to reload after changes.
Debugging
Content Script Debugging
To debugcontent.js:
- Open any webpage
- Right-click and select Inspect (or press F12)
- Go to the Console tab
- Look for messages from
content.js - Use the Sources tab to set breakpoints
Background Script Debugging
To debugbackground.js:
- Go to
chrome://extensions/ - Find Knowledge Tooltip
- Click Inspect views: service worker
- A DevTools window will open for the background script
Service workers may become inactive after periods of inactivity. Click the link again to wake it up and view console logs.
Popup Debugging
To debugpopup.js:
- Click the extension icon to open the popup
- Right-click inside the popup
- Select Inspect
- DevTools will open for the popup
Testing APIs
Wikipedia, Wiktionary, Wikidata
These APIs require no authentication and work immediately:- Test with common terms: “Albert Einstein”, “philosophy”, “Paris”
- Test with Arabic terms: “مصر”, “علم”
- Check both English and Arabic language modes
OpenAI API (AI and Translate tabs)
The AI and Translate features require an OpenAI API key:- Get an API key from platform.openai.com
- Click the extension icon
- Click Add API key
- Enter your key and click Save
- Test the AI and Translate tabs
Common Issues
Extension Not Appearing
- Ensure Developer mode is enabled
- Check that you selected the correct folder (containing
manifest.json) - Look for errors on the extensions page
Changes Not Taking Effect
- Make sure you reloaded the extension
- Refresh the webpage where you’re testing
- Check the console for JavaScript errors
CORS Errors
- All API calls should go through
background.js - The
host_permissionsinmanifest.jsonmust include the API domain - Content scripts cannot make direct API calls due to CORS restrictions
Next Steps
Project Structure
Learn about the codebase organization and architecture
Contribution Guidelines
Read the guidelines for contributing code