From Sandcat Browser

Objects: OSR

Methods

osr:new()

Creates the Sandcat Chromium OSR object

osr:loadrequest(method,url[,postdata])

Sends a HTTP request and loads its response. The third parameter is optional; can be used in POST requests. This method can alternatively be called with a single table parameter (see below)

osr:loadrequest(luatable)

Sends a custom HTTP request and loads its response
See Request for details

osr:loadsource(source,url)

Renders a source code string

osr:loadurl(url)

Goes to the supplied url

osr:reload(ignorecache)

Reloads the page. If the first parameter is supplied and is true, the cache will be ignored

osr:runjs(jscode[,url,startline,reporterrors])

Executes a JavaScript code in the loaded page. The last three parameters are optional

osr:sendrequest(luatable)

Sends a custom HTTP request
See Request for details

osr:showauthdialog([username,password])

Displays the basic authentication dialog. The username and password parameters are optional. If supplied, they are used as default values in the dialog

osr:stop()

Stops loading a page

osr:release()

Frees the OSR object

Properties

captureurlsbooleanEnables or disables the capture of URLs during operation (Default: false)
downloadfilesbooleanEnables or disables the download of files during operation (Default: false)
getsourceastextbooleanDefines if the source must be returned as text
resliststringGets the list of resources (images, CSS files, etc) of the loaded page
urlstringGets or sets the URL of the renderer
urlliststringGets a list of URLs captured during operation (requires captureurls enabled)

Events

onaddresschangefunctionIf set, called when the URL of the renderer changes (eg, after a 302 redirect)
Receives a string containing the new URL
onbeforepopupfunctionIf set, called before creating a popup window
Receives a table parameter containing the keys: url
onconsolemessagefunctionIf set, called when there is a JavaScript execution error or when console.log() is called
Receives a table parameter containing the keys: message, source and line
ondownloadstartfunctionIf set, called before starting a file download
Receives a table parameter containing the keys: id, suggestedname
onloadendfunctionIf set, called when the page finishes loading
Receives a table parameter containing the keys: statuscode
onloaderrorfunctionIf set, called when there is a error during operations
Receives a table parameter containing the keys: errorcode, errortext and failedurl
onloadstatechangefunctionIf set, called when the loading state of a page changes
Receives a table parameter containing the keys: isloading, cangoback and cangoforward
onrequestdonefunctionIf set, called after every request
Receives a table as first parameter and a JSON string as second parameter. They contain request details in the form of keys
onresourcefoundfunctionIf set, called when resouce files (images, CSS, etc) are loaded
Receives a string containing the resource URL
onsetsourcefunctionIf set, called when the page finishes loading
Receives a string containing the page source code
Retrieved from http://www.syhunt.com/sandcat/index.php?n=Objects.OSR
Page last modified on November 21, 2015, at 11:09 AM