Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phonegap links not working

I am building a phonegap app for iOS which works perfectly and beautifully except for the links. Neither internal nor external links are functioning. I made internal links work by using jquery animations, but for the life of me, I cannot figure out how to get the external links working. I thought it might be a problem with my code, so I created a new phonegap app and tried to use the external link in the default code, but that link also didn't work. I assume, then, that it's a problem with phonegap, but that doesn't tell me at all how to fix it. Any ideas? Here's a zip of all my app's code. http://cl.ly/0K0g1d3A0s2e2M0o0E34

I've tried triggering the link in a variety of different ways with jquery, but to no avail.

like image 994
fubeca Avatar asked Oct 10 '22 13:10

fubeca


2 Answers

The fact that the link in the default PhoneGap app didn't work for you makes me think you have not added your ExternalHosts entries correctly in PhoneGap.plist

Are there any errors in the console relating to the WhiteList?

eg: ERROR whitelist rejection: url='http://www.phonegap.com/start#ios-x4'

The error above shows in the Xcode console when clicking on the link in the default PhoneGap app before adding www.phonegap.com as an entry in the ExternalHosts key in PhoneGap.plist.

Try adding a single entry under the ExternalHosts key with a value of * to see if that is the issue.

like image 64
Devgeeks Avatar answered Oct 13 '22 10:10

Devgeeks


the problem is inside your touchstart routine:

$(document).bind('touchstart touchend touchmove', function(e) {
     e.preventDefault();
....
});

you are always preventing the default behaviour (for links to open a new page...)

Remove the preventDefault for link elements and you should be fine

like image 42
Daniel Kurka Avatar answered Oct 13 '22 12:10

Daniel Kurka