Question

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.

Was it helpful?

Solution

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'});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top