Framework v4 BETA

InAppBrowser

Launches in app Browser

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

Installation

  1. Install the Cordova and Ionic Native plugins:
    shell
    $ ionic cordova plugin add cordova-plugin-inappbrowser
    $ npm install --save @ionic-native/[email protected]
    
  2. Add this plugin to your app's module

Supported Platforms

  • AmazonFire OS
  • Android
  • Browser
  • iOS
  • macOS
  • Windows

Usage

typescript
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';

constructor(private iab: InAppBrowser) { }


...


const browser = this.iab.create('https://ionicframework.com/');

browser.executeScript(...);

browser.insertCSS(...);
browser.on('loadstop').subscribe(event => {
   browser.insertCSS({ code: "body{color: red;" });
});

browser.close();


Instance Members

create

Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.

Parameters

url

Type: string
The URL to load.

target

Type: string
The target in which to load the URL, an optional parameter that defaults to _self. optional

options

Options for the InAppBrowser. Optional, defaulting to: location=yes. The options string must not contain any blank space, and each feature's name/value pairs must be separated by a comma. Feature names are case insensitive. optional


InAppBrowserEvent

AT_TARGET

Type: intrinsic
undefined

BUBBLING_PHASE

Type: intrinsic
undefined

CAPTURING_PHASE

Type: intrinsic
undefined

Event

Type: reflection
undefined

bubbles

Type: intrinsic
undefined

cancelBubble

Type: intrinsic
undefined

cancelable

Type: intrinsic
undefined

code

Type: intrinsic
the error code, only in the case of loaderror.

currentTarget

Type: reference
undefined

defaultPrevented

Type: intrinsic
undefined

eventPhase

Type: intrinsic
undefined

isTrusted

Type: intrinsic
undefined

message

Type: intrinsic
the error message, only in the case of loaderror.

returnValue

Type: intrinsic
undefined

scoped

Type: intrinsic
undefined

srcElement

Type: union
undefined

target

Type: reference
undefined

timeStamp

Type: intrinsic
undefined

type

Type: intrinsic
the eventname, either loadstart, loadstop, loaderror, or exit.

url

Type: intrinsic
the URL that was loaded.

InAppBrowserOptions

allowInlineMediaPlayback

Type: union
undefined optional

clearcache

Type: stringLiteral
Set to yes to have the browser's cookie cache cleared before the new window is opened. optional

clearsessioncache

Type: stringLiteral
undefined optional

closebuttoncaption

Type: intrinsic
undefined optional

closebuttoncolor

Type: intrinsic
undefined optional

disallowoverscroll

Type: union
(iOS Only) Set to yes or no (default is no). Turns on/off the UIWebViewBounce property. optional

enableViewportScale

Type: union
(iOS Only) Set to yes or no to prevent viewport scaling through a meta tag (defaults to no). optional

footer

Type: union
(Android Only) Set to yes to show a close button in the footer similar to the iOS Done button. The close button will appear the same as for the header hence use closebuttoncaption and closebuttoncolor to set its properties optional

footercolor

Type: intrinsic
(Android Only) Set to a valid hex color string, for example #00ff00 or #CC00ff00 (#aarrggbb), and it will change the footer color from default. Only has effect if user has footer set to yes optional

fullscreen

Type: stringLiteral
undefined optional

hardwareback

Type: union
undefined optional

hidden

Type: union
undefined optional

hidenavigationbuttons

Type: union
undefined optional

hidespinner

Type: union
(iOS Only) Set to yes or no to change the visibility of the loading indicator (defaults to no). optional

hideurlbar

Type: union
undefined optional

keyboardDisplayRequiresUserAction

Type: union
(iOS Only) Set to yes or no to open the keyboard when form elements receive focus via JavaScript's focus() call (defaults to yes). optional

location

Type: union
Set to yes or no to turn the InAppBrowser's location bar on or off. optional

mediaPlaybackRequiresUserAction

Type: union
undefined optional

navigationbuttoncolor

Type: intrinsic
undefined optional

presentationstyle

Type: union
(iOS Only) Set to pagesheet, formsheet or fullscreen to set the presentation style (defaults to fullscreen). optional

shouldPauseOnSuspend

Type: union
(Android Only) Set to yes to make InAppBrowser WebView to pause/resume with the app to stop background audio (this may be required to avoid Google Play issues) optional

suppressesIncrementalRendering

Type: union
(iOS Only) Set to yes or no to wait until all new view content is received before being rendered (defaults to no). optional

toolbar

Type: union
(iOS Only) Set to yes or no to turn the toolbar on or off for the InAppBrowser (defaults to yes) optional

toolbarcolor

Type: intrinsic
undefined optional

toolbarposition

Type: union
(iOS Only) Set to top or bottom (default is bottom). Causes the toolbar to be at the top or bottom of the window. optional

toolbartranslucent

Type: union
(iOS Only) Set to yes or no to make the toolbar translucent(semi-transparent) (defaults to yes). Only applicable if toolbar is not disabled. optional

transitionstyle

Type: union
(iOS Only) Set to fliphorizontal, crossdissolve or coververtical to set the transition style (defaults to coververtical). optional

useWideViewPort

Type: union
(Android Only) Sets whether the WebView should enable support for the "viewport" HTML meta tag or should use a wide viewport. When the value of the setting is no, the layout width is always set to the width of the WebView control in device-independent (CSS) pixels. When the value is yes and the page contains the viewport meta tag, the value of the width specified in the tag is used. If the page does not contain the tag or does not provide a width, then a wide viewport will be used. (defaults to yes). optional

zoom

Type: union
(Android Only) Set to yes to show Android browser's zoom controls, set to no to hide them. Default value is yes. optional