jenswirf
jenswirf

Reputation: 7317

Iphone Phonegap links opening differently, why?

In my Phonegap app I have two links, each opening a social feed:

<a href="http://m.facebook.com/pages/account">Go To Facebook</a>
<a href="http://mobile.twitter.com/account">Go To Twitter</a>

To my surprise, these open differently on my device (iphone 4, ios5).

The facebook link opens 'in the app' whereas the twitter link opens up an external safari window.

What am I missing here?

PS. I quite liked opening the facebook page 'in the app', but it completed locked up the app since there was no way of getting back. Any thoughts?

Upvotes: 1

Views: 906

Answers (1)

Titouan de Bailleul
Titouan de Bailleul

Reputation: 12949

I have no idea why these two links open differently, but what I know is a PhoneGap application is actually a native app which opens a WebView and load you HTML page in it. So, if you click on a link, it will behave like a web browser except you don't have any controls like Go to Previous, Go to next or Refresh...

From here you have multiple options, you can choose to open external links within Safari and then take a look at this link

http://www.tonylea.com/2011/phonegap-external-link/

Or you can stick with opening links within your phonegap app but then you won't have any web controls.

To solve this problem, I guess you need to create you own custom webview and load the url within it. That way you can add controls to this web view, like a Close button which will shut down the currently opened web view and return to you app.

Then, you just need to, when you click on a link, open this web view.

But you need to know a bit about Objective-C and iOS Development.

Hope this helps

Upvotes: 1

Related Questions