Skip to main content
This guide walks you through setting up Scramjet, a powerful web proxy framework that enables you to create isolated browsing contexts.

Prerequisites

Before you begin, ensure you have:
  • A web server capable of serving static files
  • Service worker support in your target browsers
  • The Scramjet distribution files (scramjet.all.js, scramjet.wasm.wasm, scramjet.sync.js)

Installation

1

Include Scramjet files

Place the Scramjet distribution files in your project directory. These files should be accessible via your web server:
2

Register the service worker

Create a script to register Scramjet’s service worker. This is essential for intercepting and proxying requests:
The service worker file (sw.js) should import Scramjet using importScripts('/scramjet.all.js') and set up the fetch handler. See the quickstart guide for a complete service worker example.
The scope parameter defines the URL prefix that the service worker will intercept. By default, Scramjet uses /scramjet/.
3

Initialize the controller

After the service worker is registered and ready, load and initialize the Scramjet controller:
4

Create and use a frame

Create an isolated iframe context for proxied browsing:

Complete example

Here’s a full working example that ties everything together:

Configuration options

The ScramjetController constructor accepts a configuration object with the following options:
The URL prefix for the proxy. Defaults to /scramjet/.
Feature flags that control Scramjet’s behavior. See Configuration flags for details.
Custom URL encoding/decoding functions. See Custom codecs for details.
Paths to Scramjet distribution files.

Next steps

Working with frames

Learn how to create and manage isolated browsing contexts

Event handling

Handle navigation and download events

Configuration flags

Customize Scramjet’s behavior with feature flags

Custom codecs

Implement custom URL encoding strategies