TheBritishAreComing
TheBritishAreComing

Reputation: 1717

Phonegap external links have stopped working in testflight only

Got an app, it's been fine for over a year. Suddenly external links have stopped working.

It only breaks in Test flight + Live

If I run it through the Phonegap Dev app, local browser or even when you run direct from XCode it works perfectly.

Example links i've tried

<a href="https://somewebsite.com/terms-conditions" onclick="window.open(this.href,'_blank','location=yes'); return false;">terms and conditions</a>

<a href="https://somewebsite.com/terms-conditions" onclick="window.open(this.href,'_system','location=yes'); return false;">terms and conditions</a>

<a href="https://somewebsite.com/terms-conditions" target="_blank">terms and conditions</a>

<a href="https://somewebsite.com/terms-conditions" target="_system">terms and conditions</a>

In the config.xml

    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <allow-navigation href="https://somewebsite.com/*" />
    <allow-intent href="itms:*" />
    <allow-intent href="itms-apps:*" />

Sometimes the link will open but it will take 10+ presses before it does. Using Phonegap 8.2.2, iOS + Desktop Only, Both at the latest build version and Framework 7.

I've even modified the CDVUIWebViewDelegate method shouldStartLoadWithRequest

- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
{

    NSString *url = [NSString stringWithFormat:@"%@",request.URL];

    if([url containsString:@"https:"] || [url containsString:@"http:"]){
        if([url containsString:@"somewebsite."] && [url containsString:@".com/terms-conditions"])
        {
            [[UIApplication sharedApplication] openURL:[request URL]];
            return NO;
        }
    }

Upvotes: 1

Views: 388

Answers (2)

Piero Alberto
Piero Alberto

Reputation: 3943

You have to use the plugin cordova-plugin-inappbrowser .

This is due to some updated iOS policy, use this and solve your problem :)

Upvotes: 1

Ramprasath Selvam
Ramprasath Selvam

Reputation: 4448

Once Update your plugin cordova-plugin-inappbrowser after moving to testflight and test it.

Upvotes: 1

Related Questions