Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
handling links in a webview
## jQuery [plain_text]
Make sure you make a reference to the jQuery library in the header of your HTML. Also remember that you must load the HTML into the WebView from a local file.
## This event definition goes in you app.js [javascript]
Ti.App.addEventListener('openBrowser',function(e){
Ti.Platform.openURL(e.URL);
});
## This JQuery goes in the HTML file [javascript]
$(document).ready(function(){
$('a').each(function(){
$(this).bind('click',function(){
var theURL=this.getAttribute('href');
var eventObject = new Object;
var a = 'URL';
eventObject[a] = theURL;
// Fire Titanium Event to Open the URL in a new Window
Ti.App.fireEvent('openBrowser',eventObject);
return false;
});
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.