Skip to main content
Scramjet provides a complete cookie emulation system that allows proxified pages to use cookies as if they were on the original domain. This guide explains how cookie management works and how to interact with it. When a website is accessed through Scramjet, it’s technically served from your proxy domain, not the original domain. This means normal browser cookies wouldn’t work correctly. Scramjet solves this by:
  1. Intercepting Set-Cookie headers from responses
  2. Storing cookies in IndexedDB keyed by the original domain
  3. Injecting stored cookies into requests to the original domain
  4. Emulating document.cookie to work with the stored cookies
All cookie data is stored client-side in IndexedDB under the $scramjet database.
Cookies are stored in IndexedDB with the following schema:
Each cookie is uniquely identified by:

CookieStore class

The CookieStore class manages cookie operations:

Setting cookies

Cookies are automatically set from HTTP response headers:

Getting cookies

Retrieve cookies for a specific URL:
The fromJs parameter controls whether HttpOnly cookies are included. Set it to true for JavaScript access, false for HTTP requests.
The getCookies method applies several filters:
1

Expiration check

Expired cookies are automatically removed:
2

Secure flag check

Secure cookies are only sent over HTTPS:
3

HttpOnly flag check

HttpOnly cookies are excluded from JavaScript access:
4

Path matching

Cookies are only sent to matching paths:
5

Domain matching

Cookies are only sent to matching domains:
When setting cookies, Scramjet applies sensible defaults:

Persisting cookies

The CookieStore provides methods to serialize and deserialize cookie data:

Accessing cookies in proxified pages

Inside a proxified page, document.cookie is automatically intercepted:
Cookies are stored in IndexedDB:
You can inspect cookies using browser DevTools:
1

Open DevTools

Press F12 or right-click and select “Inspect”
2

Navigate to Application tab

Click the “Application” tab (Chrome) or “Storage” tab (Firefox)
3

Find IndexedDB

Expand “IndexedDB” → “$scramjet” → “cookies”
4

View cookies

Browse the stored cookie objects

Managing cookies programmatically

You can access the cookie database directly:
Directly manipulating the IndexedDB may cause unexpected behavior. Use with caution.

Domain attribute

Cookies can be set for specific domains:

Path attribute

Cookies can be restricted to specific paths:

SameSite attribute

Common patterns

Session management

Authentication tokens

User preferences

Clearing cookies

To clear cookies for a specific site:
To clear all cookies:

Working with frames

Learn about isolated browsing contexts

Configuration flags

Configure Scramjet behavior