# Image Uploader scripting API

# CWebBrowser

## CWebBrowser class

Represents a web browser window. It is using Internet Explorer components on Windows, but is not implemented on other systems. Available since version 1.3.1 build 4270.

Creating an instance: `local webBrowser = CWebBrowser();`

Class methods:

`bool navigateToUrl(string url)`
`setTitle(string title)`
`string url()` Returns current url.
`string title()` Returns current page title or url if title is empty.
`bool showModal()` Show the web browser window and wait until it is closed. Return values - true (if the window was closed programatically), false - if the window was closed by user.
`bool exec()` Mostly the same as showModal but the window may be hidden and does not block parent window.
`bool show()`
`bool hide()`
`bool close()` Close the window. After call to this function, showModal() or exec() stops execution and returns true.
`string getDocumentContents()` Returns current page contents. `HtmlDocument document()`
`string runJavaScript(string code)`
`setSilent(bool silent)`
`addTrustedSite(string address)`
`int getMajorVersion()`
`bool close()` `setOnUrlChangedCallback(function callback, [optional] context)` Arguments passed to callback:
data - a table containing:

    {
      browser = WebBrowser,
      url = string
    }

`setOnNavigateErrorCallback(function callback, [optional] context)` Arguments passed to callback:
data - a table containing:

    {
      browser = WebBrowser,
      url = string,
      statusCode = int
    }

`setOnLoadFinishedCallback(function callback, [optional] context)` Arguments passed to callback:
data - a table containing:

    {
      browser = WebBrowser,
      url = string
    }

`setOnTimerCallback(int msecInterval, function callback, [optional] context)` Arguments passed to callback:
data - a table containing:

    {
      browser = WebBrowser,
    }

`setOnFileInputFilledCallback(int msecInterval, function callback, [optional] context)` Arguments passed to callback:
data - a table containing:

    {
      browser = WebBrowser,
      fileName = string
    }