Phonegap open link in browser
The fast way to open a link in an external browser from a PhoneGap app is to use the window.open()
function with the _system
target:
This pattern will ensure maximum UX by presenting the web page in a familiar environment.
Plugin installation
Is your PhoneGap app not behaving as expected when trying to open a link? Check you have the InAppBrowser plugin installed. It's the backstage helper enabling smooth sailing:
Managing external links in your app
Unifying link behavior on all platforms
In situations where you have both internal and external links in your app, window.open()
might behave inconsistently. Level the playing field by overwriting its default behavior:
Android link-behavior trickery
On Android, the devil is in the details, window.open()
with _system
may not work as you'd expect. Use navigator.app.loadUrl
instead:
From the onclick event of your links:
Enforcing your will on links
Use a click event listener to control how your links behave:
Maintaining web consistency
Preserve the standard web behavior of your links unless there's a compelling reason to do otherwise. Your users will thank you for the consistent UX:
Was this article helpful?