Skip to content

UrlLauncher

Inherits: Service

Methods

  • can_launch_url

    Checks whether the specified URL can be handled by some app

  • close_in_app_web_view

    Closes the in-app web view if it is currently open.

  • launch_url

    Opens a web browser or popup window to a given url.

Methods#

can_launch_url #

can_launch_url(url: str | Url) -> bool

Checks whether the specified URL can be handled by some app installed on the device.

Parameters:

  • url (str | Url) –

    The URL to check.

Returns:

  • bool

    True if it is possible to verify that there is a handler available.

  • bool

    False if there is no handler available,

  • bool

    or the application does not have permission to check. For example:

  • bool
    • On recent versions of Android and iOS, this will always return False unless the application has been configuration to allow querying the system for launch support.
  • bool
    • On web, this will always return False except for a few specific schemes that are always assumed to be supported (such as http(s)), as web pages are never allowed to query installed applications.

close_in_app_web_view #

close_in_app_web_view() -> None

Closes the in-app web view if it is currently open.

This method invokes the platform-specific functionality to close any web view that was previously opened within the application.

launch_url #

launch_url(
    url: str | Url,
    *,
    web_popup_window_name: str | UrlTarget | None = None,
    web_popup_window: bool = False,
    web_popup_window_width: int | None = None,
    web_popup_window_height: int | None = None,
) -> None

Opens a web browser or popup window to a given url.

Parameters:

  • url (str | Url) –

    The URL to open.

  • web_popup_window_name (str | UrlTarget | None, default: None ) –

    Window tab/name to open URL in.

  • web_popup_window (bool, default: False ) –

    Whether to open the URL in a browser popup window.

  • web_popup_window_width (int | None, default: None ) –

    Popup window width.

  • web_popup_window_height (int | None, default: None ) –

    Popup window height.