Jaxer.Sandbox : Object
Return to: Jaxer Framework index

The Class describing a Sandbox: a container that can load a server-side window with its own DOM, and executes JavaScript server-side, but is more protected than the regular Jaxer server-side window.

Platform Support

Jaxer Server Framework Jaxer Client Framework
1.0 no

Classes

Jaxer.Sandbox.OpenOptions

Constructors

Constructor Action Jaxer Server Framework Jaxer Client Framework
Jaxer.Sandbox Constructor([String url,] [String data,] [Object options]) : Jaxer.Sandbox
The constructor of a Sandbox: a container that can load a server-side window with its own DOM, and executes JavaScript server-side, but is more protected than the regular Jaxer server-side window.
Show Details 1.0 no

Jaxer.Sandbox([String url,] [String data,] [Object options]) : Jaxer.Sandbox

The constructor of a Sandbox: a container that can load a server-side window with its own DOM, and executes JavaScript server-side, but is more protected than the regular Jaxer server-side window.

Parameters
String url (optional)The url to load. If no url is given, nothing is loaded -- you can later use the load method to load it.
String data (optional)To GET a page from the url, leave this parameter undefined or pass in null. To POST to the url, set this parameter to the data to be POSTed. It may be a string (usually of the form name1=value&name2=value), or an object whose name->value property pairs will be used to construct such a string.
Object options (optional)A JavaScript object (hashmap) of name: value property pairs specifying how to load this Sandbox.

Returns
Jaxer.Sandbox Returns an instance of Jaxer.Sandbox

See Also

Jaxer.Sandbox.OpenOptions

Properties

Property Action Jaxer Server Framework Jaxer Client Framework
document : HTMLDocument
Returns the DOM document that's been loaded into this sandbox's window, or null if a url has not been loaded yet.
No Details 1.0 no
method : String
Returns the HTTP method (action) of the request to fetch this Sandbox's URL, e.g. 'GET' ir 'POST'
No Details 1.0 no
readyState : String
Returns the loading state of the window in the Sandbox. The possible values are:
  • 0 UNINITIALIZED -- the contents have not been set or the url has not been loaded
  • 1 LOADING -- the contents are being set or the url is being loaded
  • 2 LOADED -- the contents have been set or the url has been loaded
  • 3 INTERACTIVE -- all network operations have completed
  • 4 COMPLETED -- all operations have completed
No Details 1.0 no
requestHeaders : Object
Returns the HTTP headers of the request to fetch this Sandbox's URL as properties on the returned object
No Details 1.0 no
status : Number
Returns the HTTP status of the response to the request to fetch this Sandbox's URL, e.g. 200 (i.e. OK)
No Details 1.0 no
statusText : String
Returns the HTTP status text of the response to the request to fetch this Sandbox's URL, e.g. 'OK' (for a status of 200)
No Details 1.0 no
window : ChromeWindow
Returns the window that's been loaded into this sandbox, or null if a url has not been loaded yet.
No Details 1.0 no
static defaults : Jaxer.Sandbox.OpenOptions
The default OpenOptions which new calls to new Jaxer.Sandbox() or Jaxer.Web.load() will use, unless overridden by the options argument.
No Details 1.0 no

Functions

Method Action Jaxer Server Framework Jaxer Client Framework
close() : void
Closes the Sandbox's window, which terminates any async loading and removes the window and its document. This call is usually optional, since the window and its document are automatically removed at the end of the Jaxer request, and they are safely reused if you open (load) the same Sandbox more than once. It's therefore mostly useful for stopping open async requests.
No Details 1.0 no
open(String url, [String data,] [Object options]) : void
Opens the sandbox's window and document by creating them (if needed) and then loading a url into them, via a GET or POST request. You usually do not need to explicitly close() this, except to cancel async requests.
Show Details 1.0 no

Parameters
String url The url to load from
String data (optional)To GET a page from the url, leave this parameter undefined or pass in null. To POST to the url, set this parameter to the data to be POSTed. It may be a string (usually of the form name1=value&name2=value), or an object whose name->value property pairs will be used to construct such a string.
Object options (optional)A JavaScript object (hashmap) of name: value property pairs specifying how to load this Sandbox.

See Also

Jaxer.Sandbox.prototype.close

responseHeaders() : void
Returns the HTTP headers of the response to the request to fetch this Sandbox's URL as properties on the returned object
No Details 1.0 no
setContents([String contents,] [Object options]) : void
Loads the sandbox's window and document from a string by creating them (if needed) and then loading the string into them. You do not need to explicitly close() this.
Show Details 1.0 no

Parameters
String contents (optional)The contents to load into the window, usually an HTML string. If a DOM node or document are used, they are converted to HTML, and if an object is passed in its toString() is used.
Object options (optional)A JavaScript object (hashmap) of name: value property pairs specifying how to load this Sandbox.

See Also

Jaxer.Sandbox.prototype.close

toHTML([Node node]) : String
Returns the HTML of the given node in the Sandbox's DOM, or of the entire Sandbox's document DOM. If the Sandbox has not yet been loaded from a url, returns an empty string ('').
Show Details 1.0 no

Parameters
Node node (optional)The HTML element or document (or DOM node) to be serialized. By default the entire Sandbox document is used.

Returns
String The complete HTML representation of the node or document and its contents, or '' if the Sandbox has no document

waitForCompletion([Number maxMillis]) : Boolean
Waits for the Sandbox's window to complete loading, allowing asynchronous processing of events to continue, up to a maximum number of milliseconds (if specified).
Show Details 1.0 no

Parameters
Number maxMillis (optional)The number of milliseconds to wait for the sandbox to complete loading before timing out and exiting. If this is zero or negative, waits indefinitely (though other timeouts may intervene).

Returns
Boolean Returns true if the Sandbox window loaded successfully (or was never initialized), false if the timeout occurred before that.

aptana_docs