ScramjetClient class is the core client that runs inside proxified contexts. It handles DOM API interception, URL rewriting, and provides the sandboxing infrastructure.
Most users won’t need to interact with
ScramjetClient directly. It’s automatically created and managed by ScramjetController and ScramjetFrame.Constructor
Creates a newScramjetClient instance.
The global object to apply Scramjet sandboxing to (typically
window or self)Properties
global
The global object this client is sandboxing.url
Gets or sets the current proxified URL.Example
locationProxy
The proxified location object.bare
TheBareClient instance for making bare requests.
cookieStore
The cookie store for cookie emulation.natives
Store for accessing native (unproxied) browser APIs.Example
descriptors
Store for accessing native property descriptors.frame
Returns theScramjetFrame instance if this client is inside a frame, or null if top-level.
isSubframe
Returnstrue if this client is running in a subframe (not created by ScramjetFrame).
Methods
hook()
Applies all Scramjet hooks to the global context. This method is called automatically during initialization.This method loads and applies all DOM and worker hooks based on the current context.
loadcookies()
Loads cookies from a cookie string.The cookie string to load
Proxy()
Proxies a function or constructor to intercept calls.The name(s) of the API to proxy (e.g.,
"fetch" or "XMLHttpRequest.prototype.open")Handler object with
apply and/or construct methodsExample
Trap()
Traps a property to intercept get/set operations.The name(s) of the property to trap (e.g.,
"window.location.href")Descriptor object with
get and/or set methodsExample
RawProxy()
Lower-level proxy method that operates directly on objects.The target object
The property name
Handler object
RawTrap()
Lower-level trap method that operates directly on objects.The target object
The property name
Descriptor object