# WebBrowser

Namespace: **Wisej.Web**

Assembly: **Wisej.Framework** (4.0.0.0)

* [Control](https://docs.wisej.com/api/wisej.web/general/control)
  * [WebBrowser](https://docs.wisej.com/api/wisej.web/content/webbrowser)

Represents a web browser control that enables the user to navigate web pages inside a form or a page.

{% tabs %}
{% tab title="C#" %}

```csharp
public class WebBrowser : Control
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class WebBrowser
    Inherits Control
```

{% endtab %}
{% endtabs %}

## Constructors

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) WebBrowser()

Initializes a new instance of the [WebBrowser](https://docs.wisej.com/api/wisej.web/content/webbrowser) class.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) WebBrowser(url, onDocumentCompleted)

Initializes a new instance of the [WebBrowser](https://docs.wisej.com/api/wisej.web/content/webbrowser) class with a URL as a string and an event handler for the DocumentCompleted event.

| Name                    | Type                                                                                                           | Description                                                                                  |
| ----------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| **url**                 | [String](https://docs.microsoft.com/dotnet/api/system.string)                                                  | The URL of the webpage to be loaded in the WebBrowser as a string.                           |
| **onDocumentCompleted** | [Action\<Object, WebBrowserDocumentCompletedEventArgs>](https://docs.microsoft.com/dotnet/api/system.action-2) | An Action delegate to handle the [DocumentCompleted](#documentcompleted) event. Can be null. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) WebBrowser(location, size, onDocumentCompleted)

Initializes a new instance of the [WebBrowser](https://docs.wisej.com/api/wisej.web/content/webbrowser) class with a specified location and size.

| Name                    | Type                                                                                                           | Description                                                                                  |
| ----------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| **location**            | [Point](https://docs.microsoft.com/dotnet/api/system.drawing.point)                                            | The location of the WebBrowser on its parent control.                                        |
| **size**                | [Size](https://docs.microsoft.com/dotnet/api/system.drawing.size)                                              | The size of the WebBrowser.                                                                  |
| **onDocumentCompleted** | [Action\<Object, WebBrowserDocumentCompletedEventArgs>](https://docs.microsoft.com/dotnet/api/system.action-2) | An Action delegate to handle the [DocumentCompleted](#documentcompleted) event. Can be null. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) WebBrowser(url, location, size, onDocumentCompleted)

Initializes a new instance of the [WebBrowser](https://docs.wisej.com/api/wisej.web/content/webbrowser) class with the specified settings.

| Name                    | Type                                                                                                           | Description                                                                                  |
| ----------------------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
| **url**                 | [String](https://docs.microsoft.com/dotnet/api/system.string)                                                  | The URL of the webpage to be loaded in the WebBrowser as a string.                           |
| **location**            | [Point](https://docs.microsoft.com/dotnet/api/system.drawing.point)                                            | The location of the WebBrowser on its parent control.                                        |
| **size**                | [Size](https://docs.microsoft.com/dotnet/api/system.drawing.size)                                              | The size of the WebBrowser.                                                                  |
| **onDocumentCompleted** | [Action\<Object, WebBrowserDocumentCompletedEventArgs>](https://docs.microsoft.com/dotnet/api/system.action-2) | An Action delegate to handle the [DocumentCompleted](#documentcompleted) event. Can be null. |

## Properties

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) BorderStyle

[BorderStyle](https://docs.wisej.com/api/wisej.web/enumerations/wisej.web.borderstyle): Indicates the border style for the control. (Default: `Solid`)

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) DefaultSize

[Size](https://docs.microsoft.com/dotnet/api/system.drawing.size): The default [Size](https://docs.microsoft.com/dotnet/api/system.drawing.size) of the control.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) ScrollBarsEnabled

[Boolean](https://docs.microsoft.com/dotnet/api/system.boolean): Returns or sets a value indicating whether scroll bars are displayed in the [WebBrowser](https://docs.wisej.com/api/wisej.web/content/webbrowser) control. (Default: `True`)

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Url

[Uri](https://docs.microsoft.com/dotnet/api/system.uri): Returns or sets the URL of the current document. (Default: `null`)

**Throws:**

* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception) The specified value when setting this property is not an absolute URI. For more information, see [IsAbsoluteUri](https://docs.microsoft.com/dotnet/api/system.uri.isabsoluteuri).

## Methods

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) GoBack()

Navigates the [WebBrowser](https://docs.wisej.com/api/wisej.web/content/webbrowser) control to the previous page in the navigation history, if one is available.

Due to IFrame security constraints, this method will not work when the source of the IFrame content is from a different domain.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) GoForward()

Navigates the [WebBrowser](https://docs.wisej.com/api/wisej.web/content/webbrowser) control to the next page in the navigation history, if one is available.

Due to IFrame security constraints, this method will not work when the source of the IFrame content is from a different domain.

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Navigate(url)

Loads the document at the location indicated by the specified [Uri](https://docs.microsoft.com/dotnet/api/system.uri) into the [WebBrowser](https://docs.wisej.com/api/wisej.web/content/webbrowser) control.

| Parameter | Type                                                    | Description                                                                                             |
| --------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| **url**   | [Uri](https://docs.microsoft.com/dotnet/api/system.uri) | A [Uri](https://docs.microsoft.com/dotnet/api/system.uri) representing the URL of the document to load. |

**Throws:**

* [ArgumentException](https://docs.microsoft.com/dotnet/api/system.argumentexception) The *url* parameter value does not represent an absolute URI. For more information, see [IsAbsoluteUri](https://docs.microsoft.com/dotnet/api/system.uri.isabsoluteuri).

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) Navigate(url)

Loads the document at the specified Uniform Resource Locator (URL) into the [WebBrowser](https://docs.wisej.com/api/wisej.web/content/webbrowser) control.

| Parameter | Type                                                          | Description                      |
| --------- | ------------------------------------------------------------- | -------------------------------- |
| **url**   | [String](https://docs.microsoft.com/dotnet/api/system.string) | The URL of the document to load. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) OnDocumentCompleted(e)

Fires the [DocumentCompleted](#documentcompleted) event.

| Parameter | Type                                                                                                                                           | Description                                                                                                                                                                    |
| --------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **e**     | [WebBrowserDocumentCompletedEventArgs](https://docs.wisej.com/api/wisej.web/content/webbrowser/wisej.web.webbrowserdocumentcompletedeventargs) | A [WebBrowserDocumentCompletedEventArgs](https://docs.wisej.com/api/wisej.web/content/webbrowser/wisej.web.webbrowserdocumentcompletedeventargs) that contains the event data. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) OnWebEvent(e)

Processes the event from the client.

| Parameter | Type                                                                           | Description      |
| --------- | ------------------------------------------------------------------------------ | ---------------- |
| **e**     | [WisejEventArgs](https://docs.wisej.com/api/wisej.core/general/wisejeventargs) | Event arguments. |

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-9bf7fa01e02f4da0f9ef90d3b049ae43e664919e%2Fprotected.png?alt=media) OnWebRender(config)

Renders the client component.

| Parameter  | Type                                                          | Description                   |
| ---------- | ------------------------------------------------------------- | ----------------------------- |
| **config** | [Object](https://docs.microsoft.com/dotnet/api/system.object) | Dynamic configuration object. |

## Events

### ![](https://1075938901-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2HvlWXJQMV7DxhGzw7Y1%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media) DocumentCompleted

[WebBrowserDocumentCompletedEventHandler](https://docs.wisej.com/api/wisej.web/content/webbrowser/wisej.web.webbrowserdocumentcompletedeventhandler) Fired when the [WebBrowser](https://docs.wisej.com/api/wisej.web/content/webbrowser) control finishes loading a web page.

## Implements

| Name                                                                                                 | Description                                                                                                                              |
| ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| [IUserData](https://docs.wisej.com/api/wisej.web/interfaces/wisej.web.iuserdata)                     | Provides access to the `UserData` and `Tag` properties associated to the component implementing this interface.                          |
| [IBindableComponent](https://docs.wisej.com/api/wisej.web/data-binding/wisej.web.ibindablecomponent) | Bindable components implement this interface.                                                                                            |
| [IDropTarget](https://docs.wisej.com/api/wisej.web/interfaces/wisej.web.idroptarget)                 | Controls that support drag & drop operations implement this interface.                                                                   |
| [IWisejComponent](https://docs.wisej.com/api/wisej.core/interfaces/wisej.core.iwisejcomponent)       | All wisej components implement this interface.                                                                                           |
| [IWisejControl](https://docs.wisej.com/api/wisej.core/interfaces/wisej.core.iwisejcontrol)           | All wisej controls derived from the [Control](https://docs.wisej.com/api/wisej.web/general/control) class must implement this interface. |
| [IWisejSerializable](https://docs.wisej.com/api/wisej.core/interfaces/wisej.core.iwisejserializable) | Allows an object to serialize itself.                                                                                                    |
