-
Notifications
You must be signed in to change notification settings - Fork 144
Home
Welcome to the cordova-plugin-safariviewcontroller wiki!
If you liked this plugin, we invite you to check out its new (experimental) android side, powered by Chrome custom tabs. Please note that this part of the plugin is not stable, so API may change in the future
install the master version of the plugin
cordova plugin add --save [email protected]:EddyVerbruggen/cordova-plugin-safariviewcontroller.git
As a rule of thumb, The API is meant to be equal to the iOS version of the plugin as much as possible
isAvailable(callback)
just like in the iOS version of the plugin.
As in iOS it accepts an options object and a success and fail callbacks.
show(successCallback, failCallback, {url, color})
supports url and color options. any other option will be ignored.
successCallback
may be called once when the tab is loaded and once when it is closed.
an object with one property: event
that describes what happened is supplied (equals to either 'loaded'
or 'closed'
)
You can get better performance if you will call warmUp
and mayLaunchUrl
before the call to `show (see below).
but don't forget tho read through the Best practices section
connectToService(successCallback, failCallback)
- trying to connect to the Chrome's custom tabs service. you must call this method before calling any of the other methods listed below.
warmUp(successCallback, failCallback)
- call this method whenever there's a chance the user will open an external url.
mayLaunchUrl(url, success, fail)
- for even better performance optimization, call this methods if there's more than a 50% chance the user will open a certain URL.