|Table of Contents|
Despite the fact that Titanium gives us the opportunity to use native UI components, sometimes we still need to make use of web content. Whether it's displaying an existing website, making use of the <canvas>, or handling an RSS feed, leveraging web content is something mobile developers need to be able to do. In order to make use of a platform's native webview component, we need only use
Ti.UI.WebView. This API allows us to create, display, and interact with both local and remote web content.
setBasicAuthentication(username, password) - A function that passes basic HTTP authentication into the
WebView. It takes 2 string parameters,
password, that will be used to authenticate.
html - A string property containing the HTML you would like to render in the
scalesPageToFit - A boolean property that indicates whether or not you would like to scale the content of the
WebView to fit its dimensions. (Also see notes about the
viewport meta tag in #Web Content For WebViews.)
url - A URL property to local or remote web content. For remote content, this parameter is the web URL. For local content, this parameter is the path, relative to the project's
Resources directory for Titanium projects, or
app/lib directories for Alloy project., to the local HTML file.