Skip to content

Instantly share code, notes, and snippets.

@boydlee
Created October 11, 2012 11:22
Show Gist options
  • Save boydlee/3871717 to your computer and use it in GitHub Desktop.
Save boydlee/3871717 to your computer and use it in GitHub Desktop.
var win = Titanium.UI.createWindow();
var webview = Titanium.UI.createWebView({
url:'https://www.google.co.uk/',
touchEnabled:true,
enableZoomControls:false,
width:Titanium.Platform.displayCaps.platformWidth,
loading:true,
left:0,
top:0,
willHandleTouches:false
});
win.add(webview);
win.open();
//opens a safari webview link call
Ti.App.addEventListener('openLink', function(e){
Ti.Platform.openURL(e.linkUrl);
});
webview.addEventListener('beforeload', function(e){
if(e.url !== 'https://www.google.co.uk/'){
webview.stopLoading();
Ti.Platform.openURL(e.url);
}
});
webview.addEventListener('swipe',function(e){
if(e.direction == 'left')
{
if(webview.canGoBack())
webview.goBack();
}
})
@vnshah
Copy link

vnshah commented Oct 11, 2012

Hi

Thanks for looking into this. How is it going to work with when someone clicks(tap) on a URL?

Thanks
Vishal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment