How cookie emulation works
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:- Intercepting
Set-Cookieheaders from responses - Storing cookies in IndexedDB keyed by the original domain
- Injecting stored cookies into requests to the original domain
- Emulating
document.cookieto work with the stored cookies
All cookie data is stored client-side in IndexedDB under the
$scramjet database.Cookie storage structure
Cookies are stored in IndexedDB with the following schema:CookieStore class
TheCookieStore class manages cookie operations:
Setting cookies
Cookies are automatically set from HTTP response headers:Getting cookies
Retrieve cookies for a specific URL:Cookie filtering
ThegetCookies 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:
Cookie defaults
When setting cookies, Scramjet applies sensible defaults:Persisting cookies
TheCookieStore provides methods to serialize and deserialize cookie data:
Accessing cookies in proxified pages
Inside a proxified page,document.cookie is automatically intercepted:
Cookie storage location
Cookies are stored in IndexedDB: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:Cookie attributes
Domain attribute
Cookies can be set for specific domains:Path attribute
Cookies can be restricted to specific paths:SameSite attribute
- Strict
- Lax
- None
Common patterns
Session management
Authentication tokens
User preferences
Clearing cookies
To clear cookies for a specific site:Related guides
Working with frames
Learn about isolated browsing contexts
Configuration flags
Configure Scramjet behavior