hi any idea why is this not working ? want to open link in safari window. if i click on link just scroll to the top. thanks for answer
var self = Titanium.UI.currentWindow; var htmlContent = "<a onclick='Titanium.Platform.openURL(\"http://www.google.com\"); return false;' href='#'><img src='../images/logo_small.png'></a>"; var webView = Ti.UI.createWebView({ html: htmlContent }); self.add(webView);
1 Answer
Hi Michal,
Tyr this method, In your html page(test.html)
<html lang="en"> <head> <title> Privacy Policy</title> <script> function openWebLink(input){ Ti.App.fireEvent('openSafari', {url:input}); } </script> </head> <body> <div> <p> Click here to open apple site <a href="#" id="http://www.apple.com/legal/sla/" onclick="openWebLink(this.id);" >http://www.apple.com/legal/sla/</a>.</p> </div> </body> </html>in your app.js
Ti.App.addEventListener('openSafari', function(data) { Ti.Platform.openURL(data.url); });Hope this helps you.
Your Answer
Think you can help? Login to answer this question!