When I click (tap) on a link in a list or a dialog, it opens the system web browser on webOS. On Android (4.0 with PhoneGap 1.4.1), it does nothing. Anyone knows why?
That's because webOS has a default handler where trying to navigate to a non-local URL opens the browser. You'll need to intercept that yourself for other platforms unless there's some tweak/plugin to PhoneGap that does that.
onLinkClick="linkClicked" should let you perform whatever action you need to to bring up links. forwarding it to a window.open() seems to work in iOS, but not in anything else.
James Harris had written a utility kind to handle this stuff (see here) however it had alot of stuff specific to his app. I have gone through and refactored it to be generic and am in the middle of testing it. I will go ahead and post it up on GitHub tonight and just warn that its not fully tested yet.
@ekdikeo: I tried onLinkClick: "linkClicked" for my main kind and I also tried document.addEventListener("click", this.linkClicked.bind(this), false); But nothing is being called.
So, I changed my dialog text from "no kind" to "HtmlContent" and in linkClicked(), I used WebIntent to open the browser:
window.plugins.webintent.startActivity({ action: WebIntent.ACTION_VIEW, url: inUrl }, function() {}, function() { alert('Failed to open link via Android Intent'); } );
A global solution (like in webOS) still would be nice to have.
Sorry I should have clarified that the solution I pointed you to does in fact work for what you want. There is a processClick() function that you attach to the container of your content and it will handle links and email addresses for you. It is dependent on the ChildBrowser plugin for PhoneGap.
Comments
- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •I tried
onLinkClick: "linkClicked"for my main kind and I also tried
document.addEventListener("click", this.linkClicked.bind(this), false);But nothing is being called.
- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •- Spam
- Abuse
0 • Off Topic Insightful •