Question

I have an application where I open an external URL with InAppBrowser plugin, so I want to change the position of bar where done button appear…

Is it possible to customize the "Done" Button of the InAppBrowser?

Was it helpful?

Solution 2

yes we can customize ...

ioS only.

  1. closebuttoncaption - set to a string that will be the caption for the "Done" button. Note that you will have to localize this value yourself.
  2. toolbar - set to 'yes' or 'no' to turn the toolbar on or off for the InAppBrowser (defaults to 'yes')

But here you can not change the position of the status bar and done button.

OTHER TIPS

You can now change the position of the toolbar by setting toolbarposition=top. It defaults to toolbarposition=bottom.

As mentioned earlier you can also customize the text of the Done button by setting closebuttoncaption=Back or whatever you like.

The latest InAppBrowser docs can now be found here (they've moved).

Phonegap v2.9.0 allows you to customize certain aspects of the InAppBrowser.

More can be found here.

window.open('http://url/', '_blank', 'toolbarposition=top');

toolbarposition: Set to top or bottom (default is bottom). Causes the toolbar to be at the top or bottom of the window.

closebuttoncaption: set to a string to use as the Done button's caption. Note that you need to localize this value yourself.

Find all options here

Just sharing an example passing multiple options in a more organized way:

// inAppBrowser
this.openUrl = url => {
    if (typeof cordova === 'undefined') return;

    let options = [
        'location=no',
        'toolbarposition=top',
        'enableViewportScale=yes',
        'transitionstyle=fliphorizontal',
        'closebuttoncaption=Back to the App'
    ];

    window.cordova.InAppBrowser.open(url, '_blank', options.join());
};

I'm sharing because I missed on the docs the part that says that multiple options should be passed as a single string, comma separated, no spaces (except, I guess, the 'closebuttoncaption' option that accepts normal spaces.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top