Reputation: 830
I'm making this app on PhoneGap which contains a Map. On the standard Google Map, it has a "Terms of use" on the bottom right. If I click this, a whole new screen opens up. But I can't use the integrated Android Backbutton.
What do I do?
Somewhere else in the project I've used this (underneath this) javascript to get back to the previous screen - but since the "Terms of Use" screen isn't a JS-file, how do I tell it what it can/cannot do (go back to previous screen) ?
document.addEventListener("backbutton", function(e){
e.preventDefault();
navigator.app.backHistory();
}, true);
Upvotes: 5
Views: 3625
Reputation: 91
If you are still having this problem. My solution was to capture the click event to the links in the map canvas, prevent default, get the links url, then open the url in the InAppBrowser.
$('#map_canvas').on('click', 'a', function(e){
e.preventDefault();
window.open($(this).attr('href'), '_blank');
});
http://docs.phonegap.com/en/2.7.0/cordova_inappbrowser_inappbrowser.md.html#InAppBrowser
Upvotes: 9