Class

# WebSession

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

This is the base class for the `Session</api/web/session>` class that is included in all web projects. Each user session gets its own instance of <span class="title-ref">WebSession</span> that you can access using the `Session</api/web/session>` method.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                                            | Type                                          | Read-Only | Shared |
|-----------------------------------------------------------------|-----------------------------------------------|-----------|--------|
| `AllowTabOrderWrap<websession.allowtaborderwrap>`               | `Boolean</api/data_types/boolean>`            |           |        |
| `ClientHeight<websession.clientheight>`                         | `Integer</api/data_types/integer>`            | ✓         |        |
| `ClientTime<websession.clienttime>`                             | `DateTime</api/data_types/datetime>`          | ✓         |        |
| `ClientWidth<websession.clientwidth>`                           | `Integer</api/data_types/integer>`            | ✓         |        |
| `ColorMode<websession.colormode>`                               | `ColorModes<websession.colormodes>`           |           |        |
| `ConfirmDisconnectMessage<websession.confirmdisconnectmessage>` | `String</api/data_types/string>`              |           |        |
| `Cookies<websession.cookies>`                                   | `WebCookieManager</api/web/webcookiemanager>` | ✓         |        |
| `CurrentPage<websession.currentpage>`                           | `WebPage</api/user_interface/web/webpage>`    |           |        |
| `DisconnectMessage<websession.disconnectmessage>`               | `String</api/data_types/string>`              |           |        |
| `Hashtag<websession.hashtag>`                                   | `String</api/data_types/string>`              |           |        |
| `Identifier<websession.identifier>`                             | `String</api/data_types/string>`              | ✓         |        |
| `InterruptionMessage<websession.interruptionmessage>`           | `String</api/data_types/string>`              |           |        |
| `IsDarkMode<websession.isdarkmode>`                             | `Boolean</api/data_types/boolean>`            | ✓         |        |
| `LanguageCode<websession.languagecode>`                         | `String</api/data_types/string>`              |           |        |
| `LanguageRightToLeft<websession.languagerighttoleft>`           | `Boolean</api/data_types/boolean>`            | ✓         |        |
| `LazyLoadDependencies<websession.lazyloaddependencies>`         | `Boolean</api/data_types/boolean>`            |           |        |
| `Platform<websession.platform>`                                 | `String</api/data_types/string>`              | ✓         |        |
| `RemoteAddress<websession.remoteaddress>`                       | `String</api/data_types/string>`              | ✓         |        |
| `ScaleFactor<websession.scalefactor>`                           | `Double</api/data_types/double>`              | ✓         |        |
| `SendEventsInBatches<websession.sendeventsinbatches>`           | `Boolean</api/data_types/boolean>`            |           |        |
| `Title<websession.title>`                                       | `String</api/data_types/string>`              |           |        |
| `URL<websession.url>`                                           | `String</api/data_types/string>`              | ✓         |        |
| `UserPrefersDarkMode<websession.userprefersdarkmode>`           | `Boolean</api/data_types/boolean>`            | ✓         |        |
| `UserTimeout<websession.usertimeout>`                           | `Integer</api/data_types/integer>`            |           |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                | Parameters                                                                                                                                                            | Returns                                    | Shared |
|-----------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------|--------|
| `ExecuteJavaScript<websession.executejavascript>`   | script As `String</api/data_types/string>`                                                                                                                            |                                            |        |
| `GotoURL<websession.gotourl>`                       | URL As `String</api/data_types/string>`, inNewWindow As `Boolean</api/data_types/boolean>` = `False</api/language/false>`                                             |                                            |        |
| `HasPage<websession.haspage>`                       | page As `WebPage</api/user_interface/web/webpage>`                                                                                                                    | `Boolean</api/data_types/boolean>`         |        |
| `HasPageNamed<websession.haspagenamed>`             | viewName As `String</api/data_types/string>`, implicitOnly As `Boolean</api/data_types/boolean>` = `False</api/language/false>`                                       | `Boolean</api/data_types/boolean>`         |        |
| `Header<websession.header>`                         | name As `String</api/data_types/string>`                                                                                                                              | `String</api/data_types/string>`           |        |
| `HeaderAt<websession.headerat>`                     | index As `Integer</api/data_types/integer>`                                                                                                                           |                                            |        |
| `HeaderCount<websession.headercount>`               |                                                                                                                                                                       | `Integer</api/data_types/integer>`         |        |
| `PageAt<websession.pageat>`                         | index As `Integer</api/data_types/integer>`                                                                                                                           | `WebPage</api/user_interface/web/webpage>` |        |
| `PageCount<websession.pagecount>`                   |                                                                                                                                                                       | `Integer</api/data_types/integer>`         |        |
| `Pages<websession.pages>`                           |                                                                                                                                                                       | `Iterable</api/language/iterable>`         |        |
| `PageWithName<websession.pagewithname>`             | pageName As `String</api/data_types/string>`, implicitOnly As `Boolean</api/data_types/boolean>`                                                                      | `WebPage</api/user_interface/web/webpage>` |        |
| `Quit<websession.quit>`                             |                                                                                                                                                                       |                                            |        |
| `RawHeaders<websession.rawheaders>`                 |                                                                                                                                                                       | `String</api/data_types/string>`           |        |
| `RecordData<websession.recorddata>`                 | key As `String</api/data_types/string>`, value As `String</api/data_types/string>`                                                                                    |                                            |        |
| `RemoveData<websession.removedata>`                 | Key As `String</api/data_types/string>`                                                                                                                               |                                            |        |
| `RequestData<websession.requestdata>`               | Key As `String</api/data_types/string>`                                                                                                                               |                                            |        |
| `SaveState<websession.savestate>`                   | name As `String</api/data_types/string>`, data As `String</api/data_types/string>` = "", replace As `Boolean</api/data_types/boolean>` = `False</api/language/false>` |                                            |        |
| `Secure<websession.secure>`                         |                                                                                                                                                                       | `Boolean</api/data_types/boolean>`         |        |
| `URLParameter<websession.urlparameter>`             | name As `String</api/data_types/string>`                                                                                                                              | `String</api/data_types/string>`           |        |
| `URLParameterCount<websession.urlparametercount>`   |                                                                                                                                                                       | `Integer</api/data_types/integer>`         |        |
| `URLParameterExists<websession.urlparameterexists>` | name As `String</api/data_types/string>`                                                                                                                              | `Boolean</api/data_types/boolean>`         |        |
| `URLParameterName<websession.urlparametername>`     | zeroBasedIndex As `Integer</api/data_types/integer>`                                                                                                                  | `String</api/data_types/string>`           |        |

## Events

<div class="rst-class">

table-centered_column_4

</div>

| Name                                                          | Parameters                                                                                                                                                   | Returns                            |
|---------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| `Activated<websession.activated>`                             |                                                                                                                                                              |                                    |
| `AllowUnsupportedBrowser<websession.allowunsupportedbrowser>` | `ByRef</api/language/byref>` errorMessage As `String</api/data_types/string>`, `ByRef</api/language/byref>` sendAsHTML As `Boolean</api/data_types/boolean>` |                                    |
| `AppearanceChanged<websession.appearancechanged>`             | isDarkMode As `Boolean</api/data_types/boolean>`, userPrefersDarkMode As `Boolean</api/data_types/boolean>`                                                  |                                    |
| `Closing<websession.closing>`                                 | appQuitting As `Boolean</api/data_types/boolean>`                                                                                                            |                                    |
| `Deactivated<websession.deactivated>`                         | visible As `Boolean</api/data_types/boolean>`                                                                                                                |                                    |
| `HashtagChanged<websession.hashtagchanged>`                   | name As `String</api/data_types/string>`, data As `String</api/data_types/string>`                                                                           |                                    |
| `JavaScriptError<websession.javascripterror>`                 | errorMessage As `String</api/data_types/string>`, userDetails As `String</api/data_types/string>`                                                            | `Boolean</api/data_types/boolean>` |
| `Opening<websession.opening>`                                 |                                                                                                                                                              |                                    |
| `OrientationChanged<websession.orientationchanged>`           | angle As `Integer</api/data_types/integer>`                                                                                                                  |                                    |
| `PreparingSession<websession.preparingsession>`               | `ByRef</api/language/byref>` HTMLHeader As `String</api/data_types/string>`                                                                                  |                                    |
| `RequestedData<websession.requesteddata>`                     | key As `String</api/data_types/string>`, value As `String</api/data_types/string>`                                                                           |                                    |
| `ScaleFactorChanged<websession.scalefactorchanged>`           |                                                                                                                                                              |                                    |
| `UnhandledException<websession.unhandledexception>`           | error As `RuntimeException</api/exceptions/runtimeexception>`                                                                                                | `Boolean</api/data_types/boolean>` |
| `UserDisconnected<websession.userdisconnected>`               |                                                                                                                                                              |                                    |
| `UserTimedOut<websession.usertimedout>`                       |                                                                                                                                                              |                                    |

## Enumerations

<div id="websession.colormodes">

<div class="rst-class">

forsearch

</div>

</div>

WebSession.ColorModes

### ColorModes

> Determines which the style in which the user interface will be drawn. If `Auto` is selected, it will be drawn based upon the settings of the OS.
>
> | Enum  |
> |-------|
> | Auto  |
> | Dark  |
> | Light |

## Property descriptions

<div id="websession.allowtaborderwrap">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.AllowTabOrderWrap

**AllowTabOrderWrap** As `Boolean</api/data_types/boolean>`

> Setting this property after the `Opening<websession.opening>` event will raise an UnsupportedOperationException.

<div id="websession.clientheight">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.ClientHeight

**ClientHeight** As `Integer</api/data_types/integer>`

> The height of the client's browser when the session began.
>
> If your app has different sized layouts for different sized browsers (both desktop and mobile browsers for example), the ClientHeight (and `ClientWidth<websession.clientwidth>`) property can be used to determine which layout to show.
>
> This property is updated anytime the browser window is resized.
>
> This property is read-only.

<div id="websession.clienttime">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.ClientTime

**ClientTime** As `DateTime</api/data_types/datetime>`

> Returns a current time DateTime object, with the user's time zone.
>
> This property is read-only.

<div id="websession.clientwidth">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.ClientWidth

**ClientWidth** As `Integer</api/data_types/integer>`

> The width of the client's browser when the session beqan.
>
> If you app has different sized layouts for different sized browsers (both desktop and mobile browsers for example), the ClientWidth (and `ClientHeight<websession.clientheight>`) property can be used to determine which layout to show.
>
> This property is updated anytime the browser window is resized.
>
> This property is read-only.

<div id="websession.colormode">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.ColorMode

**ColorMode** As `ColorModes<websession.colormodes>`

> Indicates how the user interface will be drawn (Auto, Light or Dark). Auto means that it will use the OS setting.

<div id="websession.confirmdisconnectmessage">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.ConfirmDisconnectMessage

**ConfirmDisconnectMessage** As `String</api/data_types/string>`

> If the user is about to move away from the application, the app will display a message informing the user of this and asking them if they wish to stay on the page or not. This property allows you to provide your own custom message. If it is left empty, no confirmation dialog box will be displayed.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> It is up to the browser to display a generic confirmation text or your custom message.
>
> </div>

<div id="websession.cookies">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.Cookies

**Cookies** As `WebCookieManager</api/web/webcookiemanager>`

> This property is read-only.
>
> The class instance should be accessed directly rather than copied to a variable and accessed. For example, to get the number of cookies:
>
> ``` xojo
> Var cookieCount As Integer
> cookieCount = Session.Cookies.Count
> ```

<div id="websession.currentpage">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.CurrentPage

**CurrentPage** As `WebPage</api/user_interface/web/webpage>`

> Sets the Session page:
>
> ``` xojo
> Var page As New MainPage
> Session.CurrentPage = page
> ```

<div id="websession.disconnectmessage">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.DisconnectMessage

**DisconnectMessage** As `String</api/data_types/string>`

> When the connection is dropped between the user and the application and cannot be reestablished, the app will display a message informing the user. This property allows you to provide your own custom message.

<div id="websession.hashtag">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.Hashtag

**Hashtag** As `String</api/data_types/string>`

> A tag associated with a bookmarked page.
>
> Hashtags are also called anchors or URL fragments.The developer may change this at any time and the browser's URL field will update immediately without causing a page reload. If the user creates a bookmark, any tag supplied will be saved with it. The developer can read this value in the Session.Opening event and display different content accordingly.

<div id="websession.identifier">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.Identifier

**Identifier** As `String</api/data_types/string>`

> Returns the unique session identifier string.
>
> This property is read-only.

<div id="websession.interruptionmessage">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.InterruptionMessage

**InterruptionMessage** As `String</api/data_types/string>`

> If the connection is interrupted, the app will inform the user that it is trying to reestablish the connection. This property allows you to provide your own custom message.

<div id="websession.isdarkmode">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.IsDarkMode

**IsDarkMode** As `Boolean</api/data_types/boolean>`

> If `True</api/language/true>`, the user's browser is set to Dark Mode.
>
> This property is read-only.

<div id="websession.languagecode">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.LanguageCode

**LanguageCode** As `String</api/data_types/string>`

> When a browser connects to a web application and a new session is created, this property is set to the IETF Language Code provided by the browser. This code is used to help determine how dynamic constants will be rendered in your web application. One advantage to this system is that if you do not provide a translation for the user's language, you can offer them a choice and **set** this value to a supported language code. You can either use raw IETF language codes or the constants from the `Localization</api/user_interface/localization>` module.

<div id="websession.languagerighttoleft">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.LanguageRightToLeft

**LanguageRightToLeft** As `Boolean</api/data_types/boolean>`

> Indicates that the browser should draw the current language Right-to-Left.
>
> In certain cases, languages are typically drawn from right to left. These languages include Arabic, Farsi, Hebrew, Urdu and Yiddish. If the `LanguageCode<websession.languagecode>` property is set to any of these languages, this property will be automatically set to `True</api/language/true>`.
>
> This property is read-only.

<div id="websession.lazyloaddependencies">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.LazyLoadDependencies

**LazyLoadDependencies** As `Boolean</api/data_types/boolean>`

> If `True</api/language/true>`, this experimental feature will only load the libraries upon which the web framework depends to manage the client side webpage as needed. For example, the library used to manage maps will only be loaded if the page has a `WebMapViewer</api/user_interface/web/webmapviewer>` on it. This results in webpages loading faster.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This feature is experimental so use it with caution. Please provide us with feedback on your experience with it.
>
> </div>

<div id="websession.platform">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.Platform

**Platform** As `String</api/data_types/string>`

> Specifies the platform being used for this session.
>
> This property is read-only.

<div id="websession.remoteaddress">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.RemoteAddress

**RemoteAddress** As `String</api/data_types/string>`

> The session's client IP address.
>
> This property is read-only.
>
> Displays the IP address of the client browser:
>
> ``` xojo
> MessageBox("IP Address = " + Self.RemoteAddress)
> ```

<div id="websession.scalefactor">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.ScaleFactor

**ScaleFactor** As `Double</api/data_types/double>`

> Reflects the ScaleFactor of the current session.
>
> This property is read-only.

<div id="websession.sendeventsinbatches">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.SendEventsInBatches

**SendEventsInBatches** As `Boolean</api/data_types/boolean>`

> If `True</api/language/true>`, this experimental feature will send events in groups which has two potentially beneficial effects. First, layouts with many controls may be more responsive. Second, the events arrive in a specific order allowing you as the developer to be able to rely upon that order in your code.
>
> <div class="important">
>
> <div class="title">
>
> Important
>
> </div>
>
> This feature is experimental so use it with caution. Please provide us with feedback on your experience with it.
>
> </div>

<div id="websession.title">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.Title

**Title** As `String</api/data_types/string>`

> The title of the session. The title that appears in the browser is the title fo the currently displayed page. As pages are shown, the title updates accordingly.
>
> If it isn't empty, it will override the current `WebPage.Title<webpage.title>` property.

<div id="websession.url">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.URL

**URL** As `String</api/data_types/string>`

> Returns the URL to the session.
>
> This property is read-only.

<div id="websession.userprefersdarkmode">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.UserPrefersDarkMode

**UserPrefersDarkMode** As `Boolean</api/data_types/boolean>`

> If `True</api/language/true>`, the device is in dark mode.
>
> This property is read-only.

<div id="websession.usertimeout">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.UserTimeout

**UserTimeout** As `Integer</api/data_types/integer>`

> The number of seconds the end-user can be idle before the `UserTimedOut<websession.usertimedout>` event fires. Set this value to zero to disable the timeout. The default value is 0 seconds. Whether or not the user is idle is determined by the Mouse, Key and Touch events on the browser itself.
>
> This example is in the `Opening<websession.opening>` event:
>
> ``` xojo
> Self.UserTimeout = 30
> ```

## Method descriptions

<div id="websession.executejavascript">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.ExecuteJavaScript

**ExecuteJavaScript**(script As `String</api/data_types/string>`)

> Executes the JavaScript passed.

<div id="websession.gotourl">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.GotoURL

**GotoURL**(URL As `String</api/data_types/string>`, inNewWindow As `Boolean</api/data_types/boolean>` = `False</api/language/false>`)

> Opens the passed *URL* in place of the current web page or downloads a file. If *inNewWindow* is `True</api/language/true>`, the browser is asked to open the *URL* in a new window.
>
> If the browser has popup windows disabled and *inNewWindow* is `True</api/language/true>`, the method silently fails and the page is not shown.
>
> If *inNewWindow* is `False</api/language/false>`, the running web app is replaced with the specified *URL*. If you want to display an external web site within your web app, use the `WebHTMLViewer</api/user_interface/web/webhtmlviewer>` control.
>
> Display a web site in a new popup window:
>
> ``` xojo
> Session.GotoURL("http://www.wikipedia.org", True)
> ```

<div id="websession.haspage">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.HasPage

**HasPage**(page As `WebPage</api/user_interface/web/webpage>`) As `Boolean</api/data_types/boolean>`

> Returns `True</api/language/true>` if the `page</api/user_interface/web/webpage>` passed is currently instantiated within the current <span class="title-ref">WebSession</span>.

<div id="websession.haspagenamed">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.HasPageNamed

**HasPageNamed**(viewName As `String</api/data_types/string>`, implicitOnly As `Boolean</api/data_types/boolean>` = `False</api/language/false>`) As `Boolean</api/data_types/boolean>`

> Returns `True</api/language/true>` if the *viewName* passed is currently instantiated within the current <span class="title-ref">WebSession</span>. If *implicitOnly* is `True</api/language/true>` then only implicit instances of pages are considered.

<div id="websession.header">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.Header

**Header**(name As `String</api/data_types/string>`) As `String</api/data_types/string>`

> Returns the value of the HTTP header specified.

<div id="websession.headerat">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.HeaderAt

**HeaderAt**(index As `Integer</api/data_types/integer>`)

> Returns the HTML header at the *index* passed.

<div id="websession.headercount">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.HeaderCount

**HeaderCount** As `Integer</api/data_types/integer>`

> Returns the number of HTTP headers sent when the session was created.

<div id="websession.pageat">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.PageAt

**PageAt**(index As `Integer</api/data_types/integer>`) As `WebPage</api/user_interface/web/webpage>`

> Returns the instance of the `WebPage</api/user_interface/web/webpage>` at the *index* passed.

<div id="websession.pagecount">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.PageCount

**PageCount** As `Integer</api/data_types/integer>`

> Returns the number of open pages in the session.

<div id="websession.pages">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.Pages

**Pages** As `Iterable</api/language/iterable>`

> Allows you to iterate through all the `webpages</api/user_interface/web/webpage>` of a <span class="title-ref">WebSession</span>.

<div id="websession.pagewithname">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.PageWithName

**PageWithName**(pageName As `String</api/data_types/string>`, implicitOnly As `Boolean</api/data_types/boolean>`) As `WebPage</api/user_interface/web/webpage>`

> Attempts to find a page in the session with the name supplied in *pageName*. If *implicitOnly* is `True</api/language/true>`, this method will return only the implicit instance version of the page. If *implicitOnly* is `False</api/language/false>`, this method will return the first page which matches name.

<div id="websession.quit">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.Quit

**Quit**

> Ends the session.
>
> WebSession.Quit sends a message to the browser to close and tells the <span class="title-ref">WebSession</span> object that it has expired. There is still a short period of time where the session will be alive though, at least until the next time the framework looks for expired sessions.
>
> WebSession.Quit does not end the session if called from the <span class="title-ref">WebSession</span>.Opening event.

<div id="websession.rawheaders">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.RawHeaders

**RawHeaders** As `String</api/data_types/string>`

> Returns the raw header information.
>
> The raw header contains information about the browser, platform and other settings.
>
> Sample raw header:
>
> ``` 
> Host:127.0.0.1:8080
> Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> Cookie:sessionid=fc827d5d805d8088f85a20d035d0d939; ToDoUser=Paul
> User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14
> Accept-Language:en-us
> Accept-Encoding:gzip, deflate
> Connection:keep-alive
> ```
>
> Displays the raw header information in a Text Area. This code is in the Shown event handler:
>
> ``` xojo
> Me.Text = Session.RawHeaders
> ```

<div id="websession.recorddata">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.RecordData

**RecordData**(key As `String</api/data_types/string>`, value As `String</api/data_types/string>`)

> Stores a *key*/*value* pair on the browser itself.
>
> This data is stored outside the scope of the system and is persistent for all intents and purposes. It is however up to the browser how long to keep the data.

<div id="websession.removedata">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.RemoveData

**RemoveData**(key As `String</api/data_types/string>`)

> Removes the Key/Value pair saved via the `RecordData<websession.recorddata>` method.

<div id="websession.requestdata">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.RequestData

**RequestData**(key As `String</api/data_types/string>`)

> Requests the Key/Value pair saved via the `RecordData<websession.recorddata>` method. The data is also returned via the `RequestedData<websession.requesteddata>` event.

<div id="websession.savestate">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.SaveState

**SaveState**(name As `String</api/data_types/string>`, data As `String</api/data_types/string>` = "", replace As `Boolean</api/data_types/boolean>` = `False</api/language/false>`)

> Saves the *name* / *data* pair to a per-session stack so you can restore the page when the user returns via their browser's Back button.
>
> When the user navigates between pages, the `HashtagChanged<websession.hashtagchanged>` event will then fire and pass back to you the *name* / *data* pair you previously saved from the top of the stack. The Name is automatically used as the page's hashtag. The data is whatever you need to restore the contents of the page. It can be in any form that `String</api/data_types/string>` supports.
>
> You can call SaveState at any time while a page is present. Passing `True</api/language/true>` for the *replace* parameter, replaces the *name* / *data* pair saved the last time SaveState was called with the new *name* / *data* pair.
>
> Data is only removed from this stack when you save a new state in the middle of the stack. For instance, if you were to save the state five times, press BACK twice and save again, it would remove the old fourth and fifth items and add the new one to the end.
>
> The stack is stored client-side with the browser.

<div id="websession.secure">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.Secure

**Secure** As `Boolean</api/data_types/boolean>`

> Gets the SSL status of the WebPage.

<div id="websession.urlparameter">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.URLParameter

**URLParameter**(name As `String</api/data_types/string>`) As `String</api/data_types/string>`

> Returns the value of the specified URL parameter. If the parameter was specified more than once, the value will be a comma separated list of values.
>
> The URL parameter are the special values that are passed along with the URL after the "?" character. For example:
>
> ``` plain
> http://example.com?my_favorite_number=42&my_name=Ford
> ```
>
> Additional parameters are separated by the "&" character. Note that all parameters must be URL encoded (%20 instead of spaces, for example).
>
> If the requested URL parameter is not available, this function returns "".
>
> For URLs that contain a port number, you have to include a "/" before the first parameter:
>
> ``` plain
> http://127.0.0.1:8080/?test=hello
> ```
>
> This code in the Session.Opening event handler displays the URL parameters in a Text Area on the main web page:
>
> ``` xojo
> If Self.URLParameterCount > 0 Then
>   Var parameterName, value As String
>   For i As Integer = 0 To Self.URLParameterCount - 1
>     parameterName = Self.URLParameterName(i)
>     value = Self.URLParameter(parameterName)
>     WebPage1.TextArea1.Text = WebPage1.TextArea1.Text + parameterName + " = " + value + EndOfLine
>   Next
> End If
> ```

<div id="websession.urlparametercount">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.URLParameterCount

**URLParameterCount** As `Integer</api/data_types/integer>`

> Returns the number of parameters that were specified in the URL

<div id="websession.urlparameterexists">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.URLParameterExists

**URLParameterExists**(name As `String</api/data_types/string>`) As `Boolean</api/data_types/boolean>`

> Returns `True</api/language/true>` if the specified parameter was in the URL.

<div id="websession.urlparametername">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.URLParameterName

**URLParameterName**(zeroBasedIndex As `Integer</api/data_types/integer>`) As `String</api/data_types/string>`

> Returns the name of the URL parameter based on the specified index.

## Event descriptions

<div id="websession.activated">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.Activated

**Activated**

> The window in which the app is running has been maximized, has gained the focus or the tab in which the app is running has been made frontmost.

<div id="websession.allowunsupportedbrowser">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.AllowUnsupportedBrowser

**AllowUnsupportedBrowser**(`ByRef</api/language/byref>` errorMessage As `String</api/data_types/string>`, `ByRef</api/language/byref>` sendAsHTML As `Boolean</api/data_types/boolean>`)

> Called when an unsupported browser connects to the web application.
>
> By default, if you do nothing in this event, an unsupported browser will be shown an error page containing a list of links to the browsers we support.
>
> If you wish to override this behavior, you can:
>
> - Set the *errorMessage* property. You may use either plain text or HTML in this field.
> - If you wish to use HTML in the *errorMessage* property, you must set the *sendAsHTML* property to `True</api/language/true>`.
> - If you wish to allow the browser to connect anyway, you may return `True</api/language/true>`.
>
> The default page for unsupported browsers shows a list of browsers that we do support with links to download them.
>
> Web apps run best on modern open-standards browsers. This includes Apple Safari and Google Chrome. Web applications should also work well in Firefox and in Internet Explorer 8 and above.

<div id="websession.appearancechanged">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.AppearanceChanged

**AppearanceChanged**(isDarkMode As `Boolean</api/data_types/boolean>`, userPrefersDarkMode As `Boolean</api/data_types/boolean>`)

> The browser's appearance has changed from light mode to dark mode or the inverse.
>
> *userPrefersDarkMode* will be `True</api/language/true>` if the device is dark mode.

<div id="websession.closing">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.Closing

**Closing**(appQuitting As `Boolean</api/data_types/boolean>`)

> The current session is closing.
>
> This is where you do any cleanup after as the session is in the process of closing. *appQuitting* will be `True</api/language/true>` if (and only if) the developer is calling the `WebApplication.Quit<webapplication.quit>` method.
>
> A session begins to close automatically when the user navigates away from your app. This could be by navigating to another URL or by closing the tab or window. You can manually end a session by redirecting the user away from the app yourself using ShowURL. After the user navigates away, the session automatically closes when the `UserTimeOut<websession.usertimeout>` property value is reached. The default is 3 minutes. If the user returns to your app (via Back or re-entering the URL) before the timeout, then the session will still be available for use.

<div id="websession.deactivated">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.Deactivated

**Deactivated**(visible As `Boolean</api/data_types/boolean>`)

> The window in which the app is running has been minimized, has lost the focus or the tab in which the app is running is no longer frontmost.
>
> If *visible* is `True</api/language/true>`, the page is still visible to the user. The ability to detect this is dependent upon the browser supporting this capability.

<div id="websession.hashtagchanged">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.HashtagChanged

**HashtagChanged**(name As `String</api/data_types/string>`, data As `String</api/data_types/string>`)

> Called when the user modifies the Hashtag in the browser address bar or when `SaveState<websession.savestate>` is called.
>
> The Hashtag feature is not limited to just simple bookmarking. For example, a single page with a list of records could change the tag whenever the record changes. By implementing the HashtagChanged event, the current record can be changed only by entering the correct tag in the URL.
>
> Displays the hash tag that the user entered in the address bar:
>
> ``` xojo
> MessageBox("Hashtag = " + Self.HashTag)
> ```

<div id="websession.javascripterror">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.JavaScriptError

**JavaScriptError**(errorMessage As `String</api/data_types/string>`, userDetails As `String</api/data_types/string>`) As `Boolean</api/data_types/boolean>`

> A JavaScript error *errorMessage* occurred.
>
> A JavaScript error indicates the web browser and the server app are out of sync. When this happens you should usually record the *errorMessage* and *userDetails* and close the Session. Further interaction with the browser is not recommended, but since your app is still running on the server, you can save the results to a file or database.
>
> By default, the framework will also write the ErrorMessage and UserDetails to a text file named Errors.log next to your web application. Returning `True</api/language/true>` will prevent the error from being written to this file.
>
> If the web application cannot create Errors.log, it will silently fail, but when running in Debug mode a message is written to the Messages area: "Could not log to errors.log, IOException."

<div id="websession.opening">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.Opening

**Opening**

> The session has started. This is a good place to do any initialization that is session/user specific.

<div id="websession.orientationchanged">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.OrientationChanged

**OrientationChanged**(angle As `Integer</api/data_types/integer>`)

> Fires when the connected device orientation changes.
>
> *angle* can be these values:
>
> - 0 = Portrait
> - 90 = Landscape Left
> - 180 = Upside Down
> - -90 = Landscape Right

<div id="websession.preparingsession">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.PreparingSession

**PreparingSession**(`ByRef</api/language/byref>` HTMLHeader As `String</api/data_types/string>`)

> The event occurs before the `Opening<websession.opening>` event which allows you to modify the HTMLHeader if necessary to do things like adding custom JavaScript libraries, fonts, etc.

<div id="websession.requesteddata">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.RequestedData

**RequestedData**(key As `String</api/data_types/string>`, value As `String</api/data_types/string>`)

> Fires in response to the `RequestData<websession.requestdata>` method being called.
>
> This event fires asynchronously in response to the `RequestData<websession.requestdata>` method.

<div id="websession.scalefactorchanged">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.ScaleFactorChanged

**ScaleFactorChanged**

> Called if/when the user moves their browser between screens if the ScaleFactor has changed.
>
> <div class="note">
>
> <div class="title">
>
> Note
>
> </div>
>
> The built-in controls automatically request new images when ScaleFactor changes.
>
> </div>

<div id="websession.unhandledexception">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.UnhandledException

**UnhandledException**(error As `RuntimeException</api/exceptions/runtimeexception>`) As `Boolean</api/data_types/boolean>`

> Receives otherwise missed exceptions — exceptions that could have been caught in an `Exception</api/exceptions/exception>` statement using one of the `Runtime</api/exceptions/runtimeexception>` exception handlers.
>
> If the appropriate `Exception</api/exceptions/exception>` statement is missing, the runtime exception error triggers this event and allows you to handle exceptions here. See the example.
>
> Returns a `Boolean</api/data_types/boolean>`. If it returns `True</api/language/true>`, the standard alert indicating an unhandled exception and quit behavior are suppressed. `Return</api/language/return>` `False</api/language/false>` to allow the default unhandled exception error processing to occur. See the `RuntimeException</api/exceptions/runtimeexception>` class.
>
> This code in the UnhandledException event of the <span class="title-ref">WebSession</span> class “catches” the unhandled `OutOfBoundsException</api/exceptions/outofboundsexception>`. Of course, it catches all unhandled OutOfBoundsExceptions throughout the application, so it doesn't know where the error occurred. You could instead place an Exception statement within a `DesktopButton.Pressed<desktopbutton.pressed>` event so that you can provide more specific diagnostics.
>
> ``` xojo
> Function UnhandledException(error As RuntimeException) As Boolean
>   If error <> Nil Then
>     Var type As String = Introspection.GetType(error).Name
>     MessageBox(type + EndOfLine + EndOfLine + String.FromArray(error.Stack, EndOfLine))
>   End If
> End Function
> ```

<div id="websession.userdisconnected">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.UserDisconnected

**UserDisconnected**

> The user closed the tab or window in which the app was running.

<div id="websession.usertimedout">

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

</div>

<div class="rst-class">

forsearch

</div>

WebSession.UserTimedOut

**UserTimedOut**

> The user's browser has been idle for the period specified by the `UserTimeout<websession.usertimeout>` property.

## Notes

Use the `Session</api/web/session>` object to access the current user session.

To refer to the current Session from within the `Session</api/web/session>` object, use `Self</api/language/self_keyword>` instead of Session as the prefix, especially in the `Opening<websession.opening>` event because it may return `Nil</api/language/nil>`.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Databases

If your application is going to connect to a database server, you will want to store the database connection in a property of the Session class. This will allow your application to make connections to the server on a user-by-user basis.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

### Query parameters

To access the query parameters, use the URLParameter methods to retrieve the query parameters from the Session object.

## Compatibility

|                       |     |
|-----------------------|-----|
| **Project Types**     | Web |
| **Operating Systems** | All |

<div class="seealso">

`Object</api/data_types/additional_types/object>` parent class; `Session</api/web/session>`, `WebSessionContext</api/web/websessioncontext>` classes.

</div>
