Skip to content
GodKratos edited this page Oct 10, 2025 · 6 revisions

You can send messages to the Temporary Containers Plus add-on to trigger functionality or gather information by using runtime.sendMessage.

Extension ID (Gecko): {1ea2fa75-677e-4702-b06a-50fc7d06fe7e}

Example:

browser.runtime.sendMessage('{1ea2fa75-677e-4702-b06a-50fc7d06fe7e}', message);

message is an object with at least the property method as String. It returns a Promise that resolves in case of success, if information was requested it'll resolve with that. In case of error the Promise rejects.

Supported messages are:

Open new Temporary Container Tab

method: string, createTabInTempContainer

url: string, the URL you want to open in the new tab (tabs.create limitations for url apply). If provided the tab is focused if active is not set to false.

active: boolean, true to focus the tab, false or undefined to open the tab in the background

deletesHistory, boolean, true to open a "Deletes History Temporary Container" - only works if the user gave history permission in the Advanced preferences, false or undefined to open a regular Temporary Container

Returns the return value of browser.tabs.create if successful. Returns undefined if no tab was created.

Notes:

  • Passing deletesHistory: true requires the user to have enabled History Deletion containers.
  • For user-facing alternatives see the Actions Popup.

Check if a Container is a Temporary Container

method: string, isTempContainer

cookieStoreId: string, the cookieStoreId to check

Returns true if the given cookieStoreId is a Temporary Container, false if not.

Example

Example (open a URL in a new temporary container, then log its container type):

async function openIsolated(url) {
	// 1. Ask extension to create a new temporary container tab with the target URL
	const createdTab = await browser.runtime.sendMessage(
		'{1ea2fa75-677e-4702-b06a-50fc7d06fe7e}',
		{
			method: 'createTabInTempContainer',
			url,
			active: true // set false to open in background
			// deletesHistory: true // uncomment if user enabled history deletion feature
		}
	);

	if (!createdTab) {
		console.warn('Tab creation was blocked or failed');
		return;
	}

	// 2. Verify the returned tab's cookieStoreId is a temporary container
	const isTemp = await browser.runtime.sendMessage(
		'{1ea2fa75-677e-4702-b06a-50fc7d06fe7e}',
		{
			method: 'isTempContainer',
			cookieStoreId: createdTab.cookieStoreId
		}
	);

	console.log('Opened tab', createdTab.id, 'in temp container?', isTemp);
}

openIsolated('https://example.com/docs');

Related: Cookie Injection | Script Injection | History Deletion Containers

Clone this wiki locally