Saint Dave
Saint Dave

Reputation: 567

External links don't open in the inAppBrowser on iOS on phonegap 2.9.0

I have some links in my phonegap page. Most of them are to pdf documents hosted on other domains (external).

If I click it on iOS, the pdf opens up, but there are no controls or buttons to go back to the previous page in the app.

Note that it works just fine on Android.

Here is my code:

$('#overlay-background').on('click', 'a',function(event) {
    var href = $(this).attr('href');
    if (typeof href !== 'undefined' && href.substr(0, 7) === 'http://')
    { 
        event.preventDefault();
        window.open(this.href, '_system');

    }
});

If anyone could help me I would be most grateful. So far it has been a real pain getting simple stuff to work on Phonegap.

Upvotes: 2

Views: 1050

Answers (1)

NovumCoder
NovumCoder

Reputation: 4637

First, _system is used to call systems browser. _blank is used to call InAppBrowser.

Then there is a third parameter you can provide. There you can set the caption for close buttons and many more.

Like {closebuttoncaption:'close'}

So try this:

window.open(this.href, '_blank', {closebuttoncaption: 'Close', toolbar: 'yes'});

Upvotes: 2

Related Questions