1.2.19 • Published 2 years ago

capacitor-inappbrowser-with-cookies v1.2.19

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@capgo/inappbrowser

Install

npm install @capgo/inappbrowser
npx cap sync

Usage

import { InAppBrowser } from '@capgo/inappbrowser'

InAppBrowser.open({ url: "YOUR_URL" });

Camera usage

if you need the Camera to work in Android, you need to add the following to your AndroidManifest.xml file:

<uses-permission android:name="android.permission.CAMERA" />

Then the permission will be asked when the camera is used.

API

open(...)

open(options: OpenOptions) => Promise<any>

Open url in a new window fullscreen

ParamType
optionsOpenOptions

Returns: Promise<any>

Since: 0.1.0


clearCookies()

clearCookies() => Promise<any>

Clear all cookies

Returns: Promise<any>

Since: 0.5.0


getCookies(...)

getCookies(options: GetCookieOptions) => Promise<{ cookies: Record<string, string>; }>

Get cookies for a specific URL.

ParamTypeDescription
optionsGetCookieOptionsThe options, including the URL to get cookies for.

Returns: Promise<{ cookies: Record<string, string>; }>


close()

close() => Promise<any>

Returns: Promise<any>


openWebView(...)

openWebView(options: OpenWebViewOptions) => Promise<any>

Open url in a new webview with toolbars

ParamType
optionsOpenWebViewOptions

Returns: Promise<any>

Since: 0.1.0


setUrl(...)

setUrl(options: { url: string; }) => Promise<any>
ParamType
options{ url: string; }

Returns: Promise<any>


addListener('urlChangeEvent', ...)

addListener(eventName: "urlChangeEvent", listenerFunc: UrlChangeListener) => Promise<PluginListenerHandle> & PluginListenerHandle

Listen for url change, only for openWebView

ParamType
eventName'urlChangeEvent'
listenerFuncUrlChangeListener

Returns: Promise<PluginListenerHandle> & PluginListenerHandle

Since: 0.0.1


addListener('closeEvent', ...)

addListener(eventName: "closeEvent", listenerFunc: UrlChangeListener) => Promise<PluginListenerHandle> & PluginListenerHandle

Listen for close click only for openWebView

ParamType
eventName'closeEvent'
listenerFuncUrlChangeListener

Returns: Promise<PluginListenerHandle> & PluginListenerHandle

Since: 0.4.0


addListener('confirmBtnClicked', ...)

addListener(eventName: "confirmBtnClicked", listenerFunc: ConfirmBtnListener) => Promise<PluginListenerHandle> & PluginListenerHandle

Will be triggered when user clicks on confirm button when disclaimer is required, works only on iOS

ParamType
eventName'confirmBtnClicked'
listenerFuncConfirmBtnListener

Returns: Promise<PluginListenerHandle> & PluginListenerHandle

Since: 0.0.1


removeAllListeners()

removeAllListeners() => Promise<void>

Remove all listeners for this plugin.

Since: 1.0.0


reload()

reload() => Promise<any>

Reload the current web page.

Returns: Promise<any>

Since: 1.0.0


Interfaces

OpenOptions

PropTypeDescriptionSince
urlstringTarget URL to load.0.1.0
headersHeadersHeaders to send with the request.0.1.0
isPresentAfterPageLoadbooleanif true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately.0.1.0
preventDeeplinkboolean

Headers

GetCookieOptions

PropType
urlstring
includeHttpOnlyboolean

HttpCookie

PropType
urlstring
keystring
valuestring

OpenWebViewOptions

PropTypeDescriptionDefaultSince
urlstringTarget URL to load.0.1.0
headersHeadersHeaders to send with the request.0.1.0
shareDisclaimerDisclaimerOptionsshare options0.1.0
toolbarTypeToolBarTypeToolbar typeToolBarType.DEFAULT0.1.0
shareSubjectstringShare subject0.1.0
titlestringTitle of the browser'New Window'0.1.0
backgroundColorBackgroundColorBackground color of the browser, only on IOSBackgroundColor.BLACK0.1.0
isPresentAfterPageLoadbooleanOpen url in a new window fullscreen isPresentAfterPageLoad: if true, the browser will be presented after the page is loaded, if false, the browser will be presented immediately.false0.1.0
showReloadButtonbooleanShows a reload button that reloads the web pagefalse1.0.15
closeModalbooleanCloseModal: if true a confirm will be displayed when user clicks on close button, if false the browser will be closed immediately.false1.1.0
closeModalTitlestringCloseModalTitle: title of the confirm when user clicks on close button, only on IOS'Close'1.1.0
closeModalDescriptionstringCloseModalDescription: description of the confirm when user clicks on close button, only on IOS'Are you sure you want to close this window?'1.1.0
closeModalOkstringCloseModalOk: text of the confirm button when user clicks on close button, only on IOS'Close'1.1.0
closeModalCancelstringCloseModalCancel: text of the cancel button when user clicks on close button, only on IOS'Cancel'1.1.0
visibleTitlebooleanvisibleTitle: if true the website title would be shown else shown emptytrue1.2.5
toolbarColorstringtoolbarColor: color of the toolbar in hex format'#ffffff''1.2.5
showArrowbooleanshowArrow: if true an arrow would be shown instead of cross for closing the windowfalse1.2.5

DisclaimerOptions

PropType
titlestring
messagestring
confirmBtnstring
cancelBtnstring

PluginListenerHandle

PropType
remove() => Promise<void>

UrlEvent

PropTypeDescriptionSince
urlstringEmit when the url changes0.0.1

BtnEvent

PropTypeDescriptionSince
urlstringEmit when a button is clicked.0.0.1

Type Aliases

Record

Construct a type with a set of properties K of type T

{

}

GetCookieOptions

Omit<HttpCookie, 'key' | 'value'>

Omit

Construct a type with the properties of T except for those in type K.

Pick<T, Exclude<keyof T, K>>

Pick

From T, pick a set of properties whose keys are in the union K

{ P in K: TP; }

Exclude

Exclude from T those types that are assignable to U

T extends U ? never : T

UrlChangeListener

(state: UrlEvent): void

ConfirmBtnListener

(state: BtnEvent): void

Enums

ToolBarType

MembersValue
ACTIVITY"activity"
NAVIGATION"navigation"
BLANK"blank"
DEFAULT""

BackgroundColor

MembersValue
WHITE"white"
BLACK"black"

Credits