Skip to content

Instantly share code, notes, and snippets.

@dawsontoth
Created April 26, 2011 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dawsontoth/3184238751130aa0206b to your computer and use it in GitHub Desktop.
Save dawsontoth/3184238751130aa0206b to your computer and use it in GitHub Desktop.
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
Ti.App.addEventListener('app:openURL', function(evt) {
alert(evt);
});
var web = Ti.UI.createWebView({
html: Ti.Filesystem.getFile('test.html').read()
});
win.add(web);
win.open();
<!DOCTYPE HTML>
<html>
<head>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.5.2.min.js"></script>
<script type="text/javascript">
$(function() {
$('a').click(function(e) {
try {
e.preventDefault();
Ti.App.fireEvent('app:openURL', { url: $(this).attr('href')});
}
catch (err) {
alert(err);
}
});
});
</script>
</head>
<body>
<a href="http://www.appcelerator.com/">Click Me to Test Events</a>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment