cordova-plugin-browser
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

cordova-plugin-browser
NPM version NPM downloads Twitter

Open browser in your app

The project allows to load urls in SFSafariViewController/Chrome Custom Tabs.

Installation

$ cordova plugin add cordova-plugin-browser

Use variable ANDROIDX_BROWSER_VERSION to override dependency version on Android:

$ cordova plugin add cordova-plugin-browser --variable ANDROIDX_BROWSER_VERSION='1.0.+'

Supported Platforms

  • iOS
  • Android

Functions

onClose

onClose(callback, errorCallback?): void

Trigger a callback when browser activity was closed.

Example

cordova.plugins.browser.onClose(() => {
    console.log("browser activity was closed");
});

Parameters

Name Type Description
callback () => void Callback function
errorCallback? (error: string) => void Error callback function

Returns

void


onLoad

onLoad(callback, errorCallback?): void

Trigger a callback when browser finished loading page successfully.

Example

cordova.plugins.browser.onLoad(() => {
    console.log("my url is loaded");
});

Parameters

Name Type Description
callback () => void Callback function
errorCallback? (error: string) => void Error callback function

Returns

void


open

open(url, options): Promise<void>

Opens a url in browser activity.

Example

cordova.plugins.browser.open("https://google.com");
cordova.plugins.browser.open("https://google.com", {readerMode: true});

Parameters

Name Type Description
url any The url to open.
options any The options for the browser.

Returns

Promise<void>

Callback when operation is completed

/cordova-plugin-browser/

    Package Sidebar

    Install

    npm i cordova-plugin-browser

    Weekly Downloads

    150

    Version

    2.1.0

    License

    MIT

    Unpacked Size

    24.4 kB

    Total Files

    16

    Last publish

    Collaborators

    • chemerisuk