Search code examples
cordovaionic-frameworkinappbrowser

How to change background color of Location bar in Cordova's InAppBrowers (Ionic Framework Project)


I have done my research on this but it seems as if it isn't possible. As the options that Cordova provides for editing the location bar are only:

  1. location: Set to yes or no to turn the InAppBrowser's location bar on or off.
  2. hardwareback: 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.

So is there a way to change the background-color of the location bar of the InAppBrowser?


Solution

  • You can use the themeablebrowser fork of cordova-plugin-inappbrowser to do this:

    cordova plugin add cordova-plugin-themeablebrowser
    

    then

    cordova.ThemeableBrowser.open('http://apache.org', '_blank', {
        toolbar: {
            color: '#ff0000ff' //RGBA
        }
    );