Background: The Cordova phonegap 2.2 application running on Android allows listening to the backbutton event
document.addEventListener(\"bac
.live() has been removed in jQuery v1.9 and is deprecated in Zepto v1.0rc1, so here's a revised version of kvaale's answer that should work well with the latest frameworks.
This version also uses PhoneGap/Cordova's InAppBrowser code, enabling you to either open the links in the InAppBrowser (using '_blank') or the system web browser (using '_system').
function directUrlToExternalBrowser(urlPattern){
var pattern = "a[href^='"+urlPattern+"']"; // detect all urls starting with urlPattern
$(document).on('click', pattern, function(e){
e.preventDefault();
var ref = window.open($(pattern).attr("href"), '_system', ''); // '_system' will open the system web browser, '_blank' will open the InAppBrowser
});
}
Then put the following code in your $(document).ready() function...
directUrlToExternalBrowser("http://maps.google.com/maps");
directUrlToExternalBrowser("http://www.google.com/intl");
If you want to detect all "a href" links (not just those for Google Maps), use the following code instead...
directUrlToExternalBrowser("http://");
directUrlToExternalBrowser("https://");