Files
firefox-containerbookmarks/README.md
Elmar Kresse d24f1d6c34
Some checks failed
Build Firefox Extension / build (push) Has been cancelled
Build Firefox Extension / release (push) Has been cancelled
docs: Add detailed explanation of how the extension works, including URL fragment identification, navigation interception, and the webNavigation permission.
2026-01-20 00:59:20 +01:00

107 lines
3.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Container Bookmarks
A Firefox extension that associates bookmarks with containers. When you click a bookmark, it automatically opens in the assigned container.
## Features
- **Right-click context menu**: Assign containers to any bookmark
- **Automatic container opening**: Bookmarks open directly in their assigned container
- **Multiple bookmarks, same URL**: Supports different containers for bookmarks pointing to the same site (e.g., personal vs work YouTube)
- **Popup overview**: View and manage all container-assigned bookmarks
- **Auto-cleanup**: Mappings are removed when bookmarks or containers are deleted
## How It Works
### URL Fragment Identification
When you assign a container to a bookmark, the extension adds a unique identifier fragment to the bookmark URL:
```
https://www.youtube.com → https://www.youtube.com#cb-abc123
```
The `#cb-<bookmarkId>` fragment allows the extension to:
1. **Identify which bookmark was clicked** - Even if multiple bookmarks point to the same URL
2. **Look up the correct container** - Each bookmark can have its own container assignment
3. **Open the clean URL** - The fragment is stripped when opening the page
### Navigation Interception
When you click a bookmark:
1. The extension detects the `#cb-` fragment in the URL
2. Extracts the bookmark ID from the fragment
3. Looks up the container assignment for that bookmark
4. Opens the **clean URL** (without fragment) in the assigned container
> **Note**: Typing a URL directly in the address bar is not intercepted - only bookmark clicks with the container fragment are redirected.
### Example: Multiple YouTube Accounts
You can have two YouTube bookmarks open in different containers:
- **Personal YouTube** (`youtube.com#cb-personal123`) → Opens in "Personal" container
- **Work YouTube** (`youtube.com#cb-work456`) → Opens in "Work" container
## Installation
### Temporary Installation (for development)
1. Open Firefox and navigate to `about:debugging#/runtime/this-firefox`
2. Click **"Load Temporary Add-on..."**
3. Navigate to this folder and select `manifest.json`
### Permanent Installation
Package the extension as a `.xpi` file and submit to [addons.mozilla.org](https://addons.mozilla.org) for review.
## Usage
### Assigning a Container to a Bookmark
1. Right-click on any bookmark (in bookmark toolbar, menu, or sidebar)
2. Click **"Set Container"**
3. Select the container you want
4. The bookmark URL will be updated with a unique identifier
### Removing a Container Assignment
1. Right-click on the bookmark
2. Click **"Set Container"** → **"Remove Container Assignment"**
3. The bookmark URL will be restored to its original form
### Opening a Bookmark in a Specific Container (One-time)
1. Right-click on any bookmark
2. Click **"Open in Container"**
3. Select the container (opens without changing the bookmark's assignment)
### Viewing Assigned Bookmarks
1. Click the extension icon in the toolbar
2. See all bookmarks with container assignments
3. Click **×** to remove an assignment
## Permissions
| Permission | Purpose |
|------------|---------|
| `bookmarks` | Read and modify bookmark URLs |
| `contextualIdentities` | Access container information |
| `cookies` | Required for container support |
| `storage` | Persist bookmark-container mappings |
| `tabs` | Open tabs in specific containers |
| `menus` | Add context menu items |
| `webNavigation` | Detect bookmark navigation and redirect |
## Development
```bash
# Clone the repository
git clone https://github.com/yourusername/firefox-container-tab.git
# Load in Firefox for testing (see Installation above)
```
## License
MIT License