Skip to main content
HLS Downloader supports both Manifest V2 (MV2) and Manifest V3 (MV3) extension architectures. This guide explains the differences and helps you choose the right version.

Overview

The extension uses different manifest versions to accommodate browser requirements:
  • Manifest V2 - Default for Firefox and legacy Chromium workflows
  • Manifest V3 - Required for modern Chromium-based browsers (Chrome, Brave, Arc, Edge)
Firefox does not fully support MV3 background service workers yet, so the MV2 build is recommended for Firefox users.

Key differences

Background execution

Uses persistent background pages that remain active throughout the browser session.
src/assets/manifest.json
{
  "manifest_version": 2,
  "background": {
    "scripts": ["background.js"],
    "persistent": true
  }
}
Characteristics:
  • Background page stays alive continuously
  • Direct access to DOM and IndexedDB
  • Works with Firefox and older Chromium versions

Permissions model

MV3 separates host permissions from regular permissions:
{
  "permissions": [
    "webRequest",
    "unlimitedStorage",
    "storage",
    "downloads",
    "tabs",
    "http://*/*",
    "https://*/*"
  ]
}

Content security policy

MV3 requires a different CSP format:
{
  "content_security_policy": "script-src 'self' 'wasm-unsafe-eval' 'unsafe-eval'; object-src 'self'"
}
Both versions require 'wasm-unsafe-eval' to support ffmpeg.wasm for video merging.

Offscreen documents (MV3 only)

Manifest V3 service workers cannot directly access DOM APIs or create object URLs. HLS Downloader uses offscreen documents to work around this limitation.

What are offscreen documents?

Offscreen documents are invisible HTML pages that run alongside the service worker, providing access to DOM APIs like IndexedDB and Blob URLs.

Implementation

The extension creates an offscreen document when needed:
src/background/src/services/indexedb-fs.ts
async function ensureOffscreenDocument() {
  if (!chromeApi?.offscreen?.createDocument) {
    return;
  }

  const hasDocument = await chromeApi.offscreen.hasDocument?.();
  if (hasDocument) {
    return;
  }

  await chromeApi.offscreen.createDocument({
    url: "offscreen.html",
    reasons: [chromeApi.offscreen.Reason.BLOBS],
    justification: "Create object URLs for download blobs",
  });
}

Use cases

The offscreen document handles:
  • Creating object URLs for download blobs
  • Managing IndexedDB operations for large file storage
  • Generating progress updates during merge operations
The background service worker sends messages to the offscreen document:
// Background sends request
chrome.runtime.sendMessage({
  target: "offscreen",
  type: "create-object-url",
  bucketId: "download-123",
  requestId: "req-456"
});

// Offscreen document responds
chrome.runtime.onMessage.addListener((message, _sender, sendResponse) => {
  if (message?.target !== "offscreen") {
    return;
  }
  
  if (message.type === "create-object-url") {
    handleCreateObjectUrl(message)
      .then(response => sendResponse(response));
    return true;
  }
});
See src/background/src/offscreen.ts:16-34 for the full implementation.

When to use each version

Use Manifest V2 if:

  • You’re installing on Firefox
  • You need a persistent background page
  • You’re using legacy Chromium versions

Use Manifest V3 if:

  • You’re installing on Chrome, Brave, Arc, Edge, or Opera
  • You want the latest Chrome-compatible build
  • You’re preparing for future Chrome Web Store requirements
Chrome Web Store no longer accepts new MV2 extensions. If you’re distributing publicly, you must use MV3.

Building different versions

The build system generates both versions:
MV_TARGET=mv2 pnpm run build
Outputs:
  • dist/ - Build artifacts
  • extension-chrome.zip - Chromium package
  • extension-firefox.xpi - Firefox package
The build system automatically includes offscreen.html when building for MV3. See scripts/copy-assets.mjs:46-51 for the copy logic.

Browser compatibility

BrowserRecommended VersionNotes
FirefoxMV2MV3 service workers not fully supported
ChromeMV3Required for Web Store
EdgeMV3Official store uses MV3
BraveMV3Chromium-based
ArcMV3Chromium-based
OperaMV3Chromium-based

Build docs developers (and LLMs) love