• Documentation

    Elanat Documentation
    The most important feature of Elanat is its add-ons-oriented structure. Add-ons-oriented structure allows you to create your own Add-ons without conflicting with Eanat core.

    WebForms Core Technology - 3.5 Browser Control Methods

    3.5 Browser Control Methods

    The WebForms class provides a set of methods for controlling browser-level behavior. These methods allow the server to generate commands that change the browser URL, page title, clipboard content, scroll position, browser history, and page navigation state.

    Unlike DOM manipulation methods, Browser methods do not primarily target an HTML element. They operate on browser-level features and are executed by WebFormsJS in the browser.

    The Browser methods provided by the WebForms class are:

    Method Purpose
    ChangeUrl Changes the current URL without performing a page navigation.
    SetHeadTitle Changes the document title.
    ClipboardWriteText Writes text to the browser clipboard.
    ScrollTo Scrolls the browser viewport to specified coordinates.
    HistoryGo Moves through the browser history.
    ReloadPage Reloads the current page.
    Redirect Redirects the browser to the specified path.

    3.5.1 ChangeUrl

    The ChangeUrl method changes the URL displayed by the browser without using a normal page redirect.

    Argument Description
    Url The URL that should become the browser's current URL.

    This method is useful when the application needs to update the browser URL while continuing to use the current document.

    Example

    In this example, the URL is obtained from the browser using Fetch.GetValue and then supplied to ChangeUrl.

    3.5.2 SetHeadTitle

    The SetHeadTitle method changes the title of the current document.

    Argument Description
    Title The new document title.

    This changes the title represented by the document's <title> element.

    Example

    The title can therefore be generated dynamically from a value available in the browser.

    3.5.3 ClipboardWriteText

    The ClipboardWriteText method writes the specified text to the browser clipboard.

    Argument Description
    Text The text to write to the clipboard.

    The operation can be followed by a WebForms Core message using the clipboard value exposed by the Fetch system.

    Example

    Here, the server instructs WebFormsJS to write the requested text to the clipboard and then uses Fetch.ClipboardText to obtain the clipboard text for the following operation.

    3.5.4 ScrollTo

    The ScrollTo method moves the browser viewport to the specified horizontal and vertical coordinates.

    It provides two overloads:

    Method Description
    ScrollTo(string X, string Y) Scrolls to the specified coordinates represented as strings.
    ScrollTo(int X, int Y) Scrolls to the specified coordinates represented as integers.
    Argument Description
    X The horizontal scroll coordinate.
    Y The vertical scroll coordinate.

    Example

    The same operation can receive values dynamically:

    This is useful when the coordinates are obtained from form fields or other browser-side values.

    3.5.5 HistoryGo

    The HistoryGo method moves the browser through its history by the specified number of steps.

    It provides two overloads:

    Method Description
    HistoryGo(string Steps) Moves through browser history using a string value.
    HistoryGo(int Steps) Moves through browser history using an integer value.
    Argument Description
    Steps The number of history entries to move. A negative value moves backward, while a positive value moves forward.

    Example

    For example, -1 moves one step backward in the browser history.

    The value can also be obtained dynamically:

    3.5.6 ReloadPage

    The ReloadPage method instructs the browser to reload the current page.

    The method does not require any arguments.

    Example

    This allows page reloading to become part of a WebForms Core command sequence.

    3.5.7 Redirect

    The Redirect method navigates the browser to the specified path.

    Argument Description
    Path The destination path.

    Example

    The destination can therefore be determined dynamically.

    3.5.8 Complete Browser Example

    The following example demonstrates all Browser methods together. Each operation is assigned to a separate command index, allowing the corresponding HTML control to trigger its own browser operation.

    The corresponding HTML can contain ordinary HTML controls. No special browser-specific markup is required:

    3.5.9 Browser Methods and WebForms Core

    Browser methods demonstrate that the WebForms class is not limited to manipulating HTML elements. A server-generated WebForms Core response can also instruct the browser to perform browser-level operations.

    These operations are still expressed through WebForms Core Action Controls. The server defines the required browser action, while WebFormsJS interprets and executes the command in the browser.

    Method Browser Operation
    ChangeUrl Changes the current browser URL.
    SetHeadTitle Changes the document title.
    ClipboardWriteText Writes text to the clipboard.
    ScrollTo Changes the viewport scroll position.
    HistoryGo Moves through browser history.
    ReloadPage Reloads the current document.
    Redirect Navigates to another path.

    This provides a unified server-side programming model for both DOM manipulation and browser control. The developer can therefore compose browser operations with other WebForms Core commands in the same server-generated response.