Event types
Scramjet provides two categories of events:- Frame events - Events specific to a
ScramjetFrameinstance - Global events - Events at the
ScramjetControllerlevel
Frame events
Frame events are fired onScramjetFrame instances and allow you to track navigation within specific iframes.
Navigate event
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):Context init event
Fired when Scramjet initializes within a frame:Event types reference
Global events
Global events are fired on theScramjetController 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:Navigation history
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:Related guides
Working with frames
Learn about ScramjetFrame and navigation methods
Configuration flags
Enable download interception and other features