Yahya Uddin
Yahya Uddin

Reputation: 28841

Titanium open url with a done button in browser window

In Titanium I know it is possible to open a URL in a browser like so:

Ti.Platform.openURL("http://example.com/foo");

However this opens it up in a browser like this:

normal

Compare that to other iOS apps like Slack and it looks like this:

Slack Browser

As you can see at the top it has a done button and it is not possible to change the url. There is also an option to open it up on Safari.

Open it up on Facebook messenger iOS app and it looks like this:

fb browser

How can I change the way Titanium opens URL's on iOS so that it uses a browser like the one used in Slack.

Upvotes: 3

Views: 679

Answers (1)

Rene Pot
Rene Pot

Reputation: 24815

What you're looking for is the native component for that, which is wrapper by Appcelerator in the module ti.safaridialog. You can see specs about it in the documentation

Add it to your app

<module platform="iphone">ti.safaridialog</module>

And then use it

var dialog = require('ti.safaridialog');
if (dialog.isSupported()) {
    dialog.open({
        url: 'http://appcelerator.com',
        title: 'Titanium rocks!',
        tintColor: 'red'
    });
}

Upvotes: 5

Related Questions