Created
October 11, 2012 11:22
-
-
Save boydlee/3871717 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi
Thanks for looking into this. How is it going to work with when someone clicks(tap) on a URL?
Thanks
Vishal