- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I've downloaded and created an android application with multiple graphic buttons. The idea is to click on a button and have the system prompt for a user to select one of the installed web browsers on the device to open a hard-coded URL. From what I've read the best way to do this is by using Intents but it doesn't seem to work. I can get the default browser to open by specifying
window.open('http://www.google.ca','_system','location=yes');
but this is not the desired behaviour. When I select the action for the button and edit script I use the following
function register_event_handlers()
{
/* graphic button Button */
$(document).on("click", ".uib_w_2", function(evt)
{
/* your code goes here */
String myURL= "http://www.google.ca";
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(myURL));
intent.setType("application/browser");
startActivity(Intent.createChooser(intent, null));
return false;
});
}
document.addEventListener("app.Ready", register_event_handlers, false);
})();
But this throws a number of errors stating Intent, myURL are not defined and "expected an assignment or function call and instead saw an expression". I'm not sure what I'm doing wrong here. Can someone please advise? I have installed the InAppBrowser for Cordova and http://*/* whitelisted for allowed-intent.
Thank you.
- Tags:
- Android* OS
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To add to this, I've tried removing the settype line - unfortunately there's no change in behavior.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page