InAppBrowser

Improve this doc

$ ionic plugin add cordova-plugin-inappbrowser

Repo: https://github.com/apache/cordova-plugin-inappbrowser

Launches in app Browser

Usage

import {InAppBrowser} from 'ionic-native';


...


let browser = new InAppBrowser('https://ionic.io', '_system');
browser.executeScript(...);
browser.insertCSS(...);
browser.close();

Instance Members

show()

Displays an InAppBrowser window that was opened hidden. Calling this has no effect if the InAppBrowser was already visible.

close()

Closes the InAppBrowser window.

executeScript(script)

Injects JavaScript code into the InAppBrowser window.

Param Type Details
script Object

Details of the script to run, specifying either a file or code key.

Returns: Promise<any>

insertCSS(css)

Injects CSS into the InAppBrowser window.

Param Type Details
css Object

Details of the script to run, specifying either a file or code key.

Returns: Promise<any>

on(name)

A method that allows you to listen to events happening in the browser.

Param Type Details
name string

of the event

Returns: Observable<InAppBrowserEvent> Returns back an observable that will listen to the event on subscribe, and will stop listening to the event on unsubscribe.

InAppBrowserEvent

Param Type Details
type string

the eventname, either loadstart, loadstop, loaderror, or exit.

url string

the URL that was loaded.

code number

the error code, only in the case of loaderror.

message string

the error message, only in the case of loaderror.

API

Native

General