Skip to main content
Scramjet provides a comprehensive event system that allows you to react to various actions happening within proxified contexts. This guide covers all available events and how to use them.

Event types

Scramjet provides two categories of events:
  1. Frame events - Events specific to a ScramjetFrame instance
  2. Global events - Events at the ScramjetController level

Frame events

Frame events are fired on ScramjetFrame instances and allow you to track navigation within specific iframes. Fired when a frame begins navigating to a new URL:
The navigate event fires before the navigation completes, making it useful for showing loading indicators or logging.

URL change event

Fired when the URL in a frame changes (including history navigation):
Use urlchange to keep your UI in sync with the current URL, such as updating address bars or page titles.

Context init event

Fired when Scramjet initializes within a frame:

Event types reference

Global events

Global events are fired on the ScramjetController instance and affect all frames.

Download events

Intercept file downloads from proxified pages:
1

Enable download interception

Set the interceptDownloads flag when creating the controller:
2

Listen for download events

Add an event listener to the controller:
3

Handle the download

Process the download data:

Download event structure

Practical examples

Building a URL bar

Create a functional URL bar that stays in sync with navigation:
Track navigation history:

Loading indicator

Show a loading indicator during navigation:

Download manager

Build a complete download manager:

Multi-frame event coordination

Coordinate events across multiple frames:

Event listener options

Scramjet events support standard addEventListener options:

Removing event listeners

Remove event listeners when they’re no longer needed:
Store listener references in variables if you need to remove them later.

Working with frames

Learn about ScramjetFrame and navigation methods

Configuration flags

Enable download interception and other features