Class

# WebLocation

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

## Description

The device location provided by the browser.

## Properties

<div class="rst-class">

table-centered_columns_3_and_4

</div>

| Name                                 | Type                                       | Read-Only | Shared |
|--------------------------------------|--------------------------------------------|-----------|--------|
| `ControlID<weblocation.controlid>`   | `String</api/data_types/string>`           | ✓         |        |
| `Enabled<weblocation.enabled>`       | `Boolean</api/data_types/boolean>`         |           |        |
| `Name<weblocation.name>`             | `String</api/data_types/string>`           | ✓         |        |
| `Page<weblocation.page>`             | `WebPage</api/user_interface/web/webpage>` | ✓         |        |
| `PanelIndex<weblocation.panelindex>` | `Integer</api/data_types/integer>`         |           |        |
| `Parent<weblocation.parent>`         | `WebView</api/user_interface/web/webview>` | ✓         |        |

## Methods

<div class="rst-class">

table-centered_column_4

</div>

| Name                                               | Parameters                                                                                                                | Returns | Shared |
|----------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|---------|--------|
| `Close<weblocation.close>`                         |                                                                                                                           |         |        |
| `ExecuteJavaScript<weblocation.executejavascript>` | script As `String</api/data_types/string>`                                                                                |         |        |
| `GoToURL<weblocation.gotourl>`                     | url As `String</api/data_types/string>`, inNewWindow As `Boolean</api/data_types/boolean>` = `False</api/language/false>` |         |        |
| `Request<weblocation.request>`                     | highAccuracy As `Boolean</api/data_types/boolean>` = `False</api/language/false>`                                         |         |        |
| `Start<weblocation.start>`                         | highAccuracy As `Boolean</api/data_types/boolean>` = `False</api/language/false>`                                         |         |        |
| `Stop<weblocation.stop>`                           |                                                                                                                           |         |        |
| `UpdateBrowser<weblocation.updatebrowser>`         |                                                                                                                           |         |        |

## Events

<div class="rst-class">

table-centered_column_4

</div>

| Name                                           | Parameters                                                                                                                                                                                                                                                                                                                           | Returns |
|------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|
| `Closed<weblocation.closed>`                   |                                                                                                                                                                                                                                                                                                                                      |         |
| `Error<weblocation.error>`                     | error As `RuntimeException</api/exceptions/runtimeexception>`                                                                                                                                                                                                                                                                        |         |
| `LocationChanged<weblocation.locationchanged>` | latitude As `Double</api/data_types/double>`, longitude As `Double</api/data_types/double>`, accuracy As `Double</api/data_types/double>`, altitude As `Double</api/data_types/double>`, altitudeAccuracy As `Double</api/data_types/double>`, course As `Double</api/data_types/double>`, speed As `Double</api/data_types/double>` |         |
| `Opening<weblocation.opening>`                 |                                                                                                                                                                                                                                                                                                                                      |         |

## Property descriptions

<div id="weblocation.controlid">

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

</div>

<div class="rst-class">

forsearch

</div>

WebLocation.ControlID

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

> Identifies the control on a per session basis.
>
> This property is read-only.

<div id="weblocation.enabled">

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

</div>

<div class="rst-class">

forsearch

</div>

WebLocation.Enabled

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

> When `True</api/language/true>` the <span class="title-ref">WebControl</span> is drawn enabled and responds to user action. When `False</api/language/false>`, the control appears as disabled and does not respond to user actions.
>
> In the case of `WebTimer</api/web/webtimer>`, when set to `False</api/language/false>` this disables and stops the WebTimer. When set to `True</api/language/true>`, it starts the WebTimer.
>
> Disable a button when a check box value changes:
>
> ``` xojo
> If AllowSaveCheckBox.Value Then
> SaveButton.Enabled = True
> Else
> AllowSaveButton.Enabled = False
> End If
> ```

<div id="weblocation.name">

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

</div>

<div class="rst-class">

forsearch

</div>

WebLocation.Name

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

> The name of the control.
>
> This property is read-only.

<div id="weblocation.page">

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

</div>

<div class="rst-class">

forsearch

</div>

WebLocation.Page

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

> Identifies the web page that contains the control.
>
> This property is read-only.

<div id="weblocation.panelindex">

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

</div>

<div class="rst-class">

forsearch

</div>

WebLocation.PanelIndex

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

> If the control has been placed on a <span class="title-ref">WebTabPanel</span> or `WebPagePanel</api/user_interface/web/webpagepanel>` control, this is the panel (page/tab) that the control is on. If the control is not on a panel, it returns -1.
>
> The first panel is numbered zero. If the control has been placed on a panel of a <span class="title-ref">WebTabPanel</span> or `WebPagePanel</api/user_interface/web/webpagepanel>` control, it returns the panel number. If the control is not on a `WebPagePanel</api/user_interface/web/webpagepanel>` or <span class="title-ref">WebTabPanel</span>, it returns -1. If you change the PanelIndex to a nonexistent panel, the control will disappear until you give it a PanelIndex value that corresponds to a panel that exists.
>
> If you are looking to change the currently selected panel (page/tab), use `SelectedPanelIndex<webpagecontrol.selectedpanelindex>`.
>
> This code displays the panel index of the control that is on the page.
>
> ``` xojo
> MessageBox(Me.SelectedPanelIndex.ToString)
> ```

<div id="weblocation.parent">

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

</div>

<div class="rst-class">

forsearch

</div>

WebLocation.Parent

**Parent** As `WebView</api/user_interface/web/webview>`

> Used to get the control's parent control or page. If the parent control is a `WebContainer</api/user_interface/web/webcontainer>`, then it returns the `WebContainer</api/user_interface/web/webcontainer>`. If it is on a `WebPage</api/user_interface/web/webpage>`, it returns the `WebPage</api/user_interface/web/webpage>`.
>
> This property is read-only.

## Method descriptions

<div id="weblocation.close">

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

</div>

<div class="rst-class">

forsearch

</div>

WebLocation.Close

**Close**

> Removes the control from the page.

<div id="weblocation.executejavascript">

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

</div>

<div class="rst-class">

forsearch

</div>

WebLocation.ExecuteJavaScript

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

> Executes the JavaScript passed. The JavaScript passed can call a JavaScript function in a WebPageSource control.
>
> The Xojo web framework uses EcmaScript 6 which is more strict than previous versions of JavaScript. For more details, see the [EcmaScript 6 documentation](https://www.ecma-international.org/ecma-262/6.0/).
>
> This code in the Pressed event of a Button displays an alert using JavaScript:
>
> ``` xojo
> Me.ExecuteJavaScript("alert('Hello!');")
> ```
>
> This code will select the text in a WebTextField (or WebTextArea):
>
> ``` xojo
> WebTextField1.ExecuteJavascript("document.getElementById('" + _
> WebTextField1.ControlID + "_inner').select();")
> ```

<div id="weblocation.gotourl">

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

</div>

<div class="rst-class">

forsearch

</div>

WebLocation.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, 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
> Me.GoToURL("http://www.wikipedia.org", True)
> ```

<div id="weblocation.request">

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

</div>

<div class="rst-class">

forsearch

</div>

WebLocation.Request

**Request**(highAccuracy As `Boolean</api/data_types/boolean>` = `False</api/language/false>`)

> Requests the user's location a single time. Setting highAccuracy to `True</api/language/true>` uses more power on mobile devices.

<div id="weblocation.start">

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

</div>

<div class="rst-class">

forsearch

</div>

WebLocation.Start

**Start**(highAccuracy As `Boolean</api/data_types/boolean>` = `False</api/language/false>`)

> Starts monitoring the user's location. Setting highAccuracy to `True</api/language/true>` uses more power on mobile devices.
>
> Only start monitoring the device location when you really need the information especially on mobile devices as monitoring uses a lot of power.

<div id="weblocation.stop">

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

</div>

<div class="rst-class">

forsearch

</div>

WebLocation.Stop

**Stop**

> Stops monitoring the user's location.
>
> Call this method as soon as you no longer need to monitor the device location especially on mobile devices as monitoring uses a lot of power.

<div id="weblocation.updatebrowser">

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

</div>

<div class="rst-class">

forsearch

</div>

WebLocation.UpdateBrowser

**UpdateBrowser**

> Forces the current values of the control to be sent to the browser.
>
> This method is useful when you are computing values in a loop and wish to update the browser immediately rather than wait until the current method ends.
>
> This code iterates through a `RowSet</api/databases/rowset>` of `database rows</api/databases/databaserow>`, updates a `ProgressBar</api/user_interface/web/webprogressbar>` and then forces the updated `ProgressBar</api/user_interface/web/webprogressbar>` to be sent to the browser via UpdateBrowser.
>
> ``` xojo
> ProgressBar1.MaximumValue = SalesData.RowCount
> For Each row As DatabaseRow in SalesData
> AnalyzeSales(row)
> ProgressBar1.Value = ProgressBar1.Value + 1
> ProgressBar1.UpdateBrowser
> Next
> ```

## Event descriptions

<div id="weblocation.closed">

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

</div>

<div class="rst-class">

forsearch

</div>

WebLocation.Closed

**Closed**

> The control has been removed from the browser either because the page has closed or the control's Close method was called.

<div id="weblocation.error">

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

</div>

<div class="rst-class">

forsearch

</div>

WebLocation.Error

**Error**(error As `RuntimeException</api/exceptions/runtimeexception>`)

> Called when an error occurs when calling the `Start<weblocation.start>` or `Request<weblocation.request>` methods.
>
> This event will be called if the browser does not support geolocation or you attempt to use it over a regular HTTP connection.

<div id="weblocation.locationchanged">

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

</div>

<div class="rst-class">

forsearch

</div>

WebLocation.LocationChanged

**LocationChanged**(latitude As `Double</api/data_types/double>`, longitude As `Double</api/data_types/double>`, accuracy As `Double</api/data_types/double>`, altitude As `Double</api/data_types/double>`, altitudeAccuracy As `Double</api/data_types/double>`, course As `Double</api/data_types/double>`, speed As `Double</api/data_types/double>`)

> Called when the device location information is received from the browser.

<div id="weblocation.opening">

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

</div>

<div class="rst-class">

forsearch

</div>

WebLocation.Opening

**Opening**

> The control has been created and the page is opening but has not been sent to the browser yet.
>
> The Opening event handler can be used to initialize non-visual properties and settings for controls.

## Notes

<span class="title-ref">WebLocation</span> works only over HTTPS connections.

## Compatibility

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

<div class="seealso">

`WebControl</api/user_interface/web/webcontrol>` parent class.

</div>
