The InAppBrowser plugin provides the ability to launch a web browser within the app.
If you have not already setup Ionic Enterprise in your app, follow the one-time setup steps.
Next, install the plugin:
name: In App Browser
description: Launches in app Browser
interfaces: InAppBrowserEvent InAppBrowserOptions
string | InAppBrowserOptions):
Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
|url||The URL to load.|
|The target in which to load the URL, an optional parameter that defaults to _self.|
|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.|
constructor : function
⊕ new __type(type:
Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise.
the error code, only in the case of loaderror.
Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise.
Returns the object whose event listener's callback is currently being invoked.
Returns true if event was dispatched by the user agent, and false otherwise.
the error message, only in the case of loaderror.
Returns the object to which event is dispatched (its target).
Returns the event's timestamp as the number of milliseconds measured relative to the time origin.
● type: InAppBrowserEventType
the event name
the URL that was loaded.
Invoking this method prevents event from reaching any registered event listeners after the current one finishes running and, when dispatched in a tree, also prevents event from reaching any other objects.
When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object.
● allowInlineMediaPlayback: "yes" | "no"
(iOS Only) Set to yes or no to allow in-line HTML5 media playback, displaying within the browser window rather than a device-specific playback interface. The HTML's video element must also include the webkit-playsinline attribute (defaults to no)
● beforeload: "yes" | "get" | "post"
set to enable the beforeload event to modify which pages are actually loaded in the browser. Accepted values are get to intercept only GET requests, post to intercept on POST requests or yes to intercept both GET & POST requests. Note that POST requests are not currently supported and will be ignored (if you set beforeload=post it will raise an error).
● clearcache: "yes"
Set to yes to have the browser's cookie cache cleared before the new window is opened.
● cleardata: "yes"
set to yes to have the browser's entire local storage cleared (cookies, HTML5 local storage, IndexedDB, etc.) before the new window is opened
● clearsessioncache: "yes"
Set to yes to have the session cookie cache cleared before the new window is opened. For WKWebView, requires iOS 11+ on target device.
(Android) Set to a string to use as the close button's caption instead of a X. Note that you need to localize this value yourself. (iOS) Set to a string to use as the Done button's caption. Note that you need to localize this value yourself.
(Android) Set to a valid hex color string, for example: #00ff00, and it will change the close button color from default, regardless of being a text or default X. Only has effect if user has location set to yes. (iOS) Set as a valid hex color string, for example: #00ff00, to change from the default Done button's color. Only applicable if toolbar is not disabled.
● disallowoverscroll: "yes" | "no"
(iOS Only) Set to yes or no (default is no). Turns on/off the UIWebViewBounce property.
● enableViewportScale: "yes" | "no"
(iOS Only) Set to yes or no to prevent viewport scaling through a meta tag (defaults to no).
● footer: "yes" | "no"
(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
(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
● fullscreen: "yes"
(Windows only) Set to yes to create the browser control without a border around it. Please note that if location=no is also specified, there will be no control presented to user to close IAB window.
● hardwareback: "yes" | "no"
(Android & Windows Only) Set to yes to use the hardware back button to navigate backwards through the InAppBrowser's history. If there is no previous page, the InAppBrowser will close. The default value is yes, so you must set it to no if you want the back button to simply close the InAppBrowser.
● hidden: "yes" | "no"
Set to yes to create the browser and load the page, but not show it. The loadstop event fires when loading is complete. Omit or set to no (default) to have the browser open and load normally.
● hidenavigationbuttons: "yes" | "no"
(Android) Set to yes to hide the navigation buttons on the location toolbar, only has effect if user has location set to yes. The default value is no. (iOS) Set to yes or no to turn the toolbar navigation buttons on or off (defaults to no). Only applicable if toolbar is not disabled.
● hidespinner: "yes" | "no"
(iOS Only) Set to yes or no to change the visibility of the loading indicator (defaults to no).
● hideurlbar: "yes" | "no"
(Android) Set to yes to hide the url bar on the location toolbar, only has effect if user has location set to yes. The default value is no.
● keyboardDisplayRequiresUserAction: "yes" | "no"
● lefttoright: "yes" | "no"
(Android) Set to yes to swap positions of the navigation buttons and the close button. Specifically, navigation buttons go to the left and close button to the right. (iOS) Set to yes to swap positions of the navigation buttons and the close button. Specifically, close button goes to the right and navigation buttons to the left.
● location: "yes" | "no"
Set to yes or no to turn the InAppBrowser's location bar on or off.
● mediaPlaybackRequiresUserAction: "yes" | "no"
Set to yes to prevent HTML5 audio or video from autoplaying (defaults to no).
(Android) Set to a valid hex color string, for example: #00ff00, and it will change the color of both navigation buttons from default. Only has effect if user has location set to yes and not hidenavigationbuttons set to yes. (iOS) Set as a valid hex color string, for example: #00ff00, to change from the default color. Only applicable if navigation buttons are visible.
● presentationstyle: "pagesheet" | "formsheet" | "fullscreen"
(iOS Only) Set to pagesheet, formsheet or fullscreen to set the presentation style (defaults to fullscreen).
● shouldPauseOnSuspend: "yes" | "no"
(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)
● suppressesIncrementalRendering: "yes" | "no"
(iOS Only) Set to yes or no to wait until all new view content is received before being rendered (defaults to no).
● toolbar: "yes" | "no"
(iOS Only) Set to yes or no to turn the toolbar on or off for the InAppBrowser (defaults to yes)
(Android) Set to a valid hex color string, for example: #00ff00, and it will change the color the toolbar from default. Only has effect if user has location set to yes. (iOS) Set as a valid hex color string, for example: #00ff00, to change from the default color of the toolbar. Only applicable if toolbar is not disabled.
● toolbarposition: "top" | "bottom"
(iOS Only) Set to top or bottom (default is bottom). Causes the toolbar to be at the top or bottom of the window.
● toolbartranslucent: "yes" | "no"
(iOS Only) Set to yes or no to make the toolbar translucent(semi-transparent) (defaults to yes). Only applicable if toolbar is not disabled.
● transitionstyle: "fliphorizontal" | "crossdissolve" | "coververtical"
(iOS Only) Set to fliphorizontal, crossdissolve or coververtical to set the transition style (defaults to coververtical).
● useWideViewPort: "yes" | "no"
(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).
● zoom: "yes" | "no"
(Android Only) Set to yes to show Android browser's zoom controls, set to no to hide them. Default value is yes.
Ƭ InAppBrowserEventType: "loadstart" | "loadstop" | "loaderror" | "exit" | "beforeload" | "message"
- GH-715 (ios): fix regression in 2706f34
- GH-656 (ios) Remove fake status bar with hardcoded height to fix issues in iOS devices with a notch
- GH-693 fix(ios): Allow loading local html files
- GH-293 Android: SSL errors handling in Android
- GH-672 fix(ios): prevent statusbar rotation after closing
- GH-669 Allow App using
InAppBrowserto be hosted in a cross-origin iframe
- GH-600 (all platforms): remove "window.open" overwrite
- GH-515 Fix incorrect TypeScript typings
- GH-654 add check for openInSystem postNotification
- GH-442 fix(android): Reset lefttoright if not set
- GH-648 (android) Correcting the documentation regarding lefttoright opt…
- GH-634 (android) Added option to turn on/off fullscreen mode in Android
- GH-616 (android)
- GH-635 breaking(ios): remove UIWebView
- GH-503 Defensive code to prevent NULL reference exceptions for async
- GH-524 Replace "beforeload" with BEFORELOAD
- GH-568 Update missing closed brace to the insert.CSS
- GH-401 Move createIframeBridge to injectDeferredObject
- fix: update types to make beforeload work
- chore: remove unused usewkwebview references
- fix(ios): make create work on iOS 13
- feat(ios): remove UIWebView code
- chore: fix repo and issue urls and license in package.json and plugin.xml (
- chore: unknown changes because of linebreak change in binary files (
- build: add
.npmignoreto remove unneeded files from npm package (
- build: add
.gitattributesto force LF (instead of possible CRLF on Windows) (
- ci(travis): Update Travis CI configuration for new paramedic (#478) (
- docs: remove outdated translations (
- fix(android): Fix beforeload for Android <= 7 (#427) (
- ci(travis) Fix failing CI tests (#460) (
- test: Fix test spec.5 to close inappbrowser after loadstop event (#440) (
- fix(android): Prevent malformed callbackId from reaching app cordova view (#436) (
- feat: CB-13969: Allow close button and navigation buttons positions to be swapped (#262) (
- docs: Add headline to window.open documentation (#406) (
- fix(ios): Fix iframes in iOS/WKWebView which were broken by #418 (#425) (
- chore(github): Add or update GitHub pull request and issue template (
- fix(ios): Handle non-default target attribute values (e.g. target=on links in WKWebView implementation on iOS (#418) (
- fix(types): remove unused replace parameter (#410) (
- documentation: Example documentation - Fix callBack function name (#383) (
- fix: Fix beforeload to work with POST requests (#367) (
- feat: (iOS & Android) Add postMessage API support (#362) (
- fix(ios): Fixes loadAfterBeforeload on iOS. (#350) (
- fix(ios): Fix crashes when using WKWebView implementation on iOS 9. (#337) (
- docs: remove unwanted information in README table (#308) (
- fix(ios): This lets the default window layering do it's thing. (#336) (
- feat(ios): CB-7179 (iOS): Add optional WKWebView support for iOS (#271) (
- docs: remove JIRA link (
- chore(types): CB-12941: update typings (#267) (
- feat: CB-14188: add beforeload event, catching navigation before it happens (#276) (
- ci(travis): reenable testing on all platforms (
- ci(travis): also accept terms for android sdk
- fix(android): CB-10795: Exclude current app from external intent list (#154) (
- fix(ios): CB-14234: Don't call handleOpenURL for system URLs (#278) (
- fix(ios): CB-12875: (iOS) Pushes the inappbrowser window to a higher ui level than the existing apps window. (#284) (
- ci: Quick CI fixes (#277) (
- fix(ios): CB-12922 (ios): fix In-app browser does not cede control (#272) (
- fix(android): CB-14061: (android) comply with RFC 3986 for custom URL scheme handling (#269) (
- fix(android): CB-14048: (android) allowedSchemes check empty string fix (#268) (
- CB-13659 iOS Add hidespinner option
- In file
AppBrowser.java: New code within
shouldOverrideUrlLoading()to check for whitelisting custom schemes via a new
AllowedSchemespreference configuration item. Allows custom schemes like
InAppBrowser.java: New method
isURLWhileListedto check for whitelisting of
AllowedSchemesin a new preference configuration item. There is a new check in
shouldOverrideUrlLoading, to allow whitelisted custom schemes like "mycoolapp://"
- Add customisation of the navigation buttons for iOS
- Fix navigation buttons on iOS