a

Thursday, 13 August 2015

Web Content

Exercise-1

Create a Webview and Include a local HTML file

Solution


<WebView url="mytest.html" height="200"></WebView>

mytest.html (Place in Assets/Android)


<html>
<body>
<div> FROM LOCAL  </div>
</body>
</html>

Exercise-2

Change the style of Webview using CSS

Solution


<html>
<head>

<link rel="stylesheet" type="text/css" href="test.css" />

.......
..........
.............

test.css (Place in Assets/Android)

body {
    background-color: #b0c4de;

}


Exercise-3



Create a Webview and Include a remote HTML file

Solution


<WebView url="http://www.google.com" height="200"></WebView>


Exercise-4



Trigger an Event from Web View and Listen from Native

Solution


Fire Event @ Web

Ti.App.fireEvent('app:fromWebView', { message: 'Message shot from web' });

Listen @Native

             Ti.App.addEventListener("app:fromWebView", function(e) {
                Ti.API.info("Message RECD at Native , which was shot from WEB"+e.message);
          
            });
            
            


Exercise- 5




Trigger an Event from NativeView and Listen from Web

Solution

Same as above

No comments:

Post a Comment