Hey,
I want to catch an event in a webview fired from Titanium. Unfortunately, I get no message... Can anyone help me? I would really appreciate it!!
WindowHome.js
var webview = Titanium.UI.createWebView({ url: '/tablet/example1.html', width: 'auto', height: 'auto' }); win1.add(webview); webview.addEventListener('beforeload', function(e){ Ti.App.fireEvent('app:getSize', { message: 'event fired from Titanium, handled in WebView' }); });example1.html
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Treemap - Animated Squarified SliceAndDice and Strip TreeMaps</title> </head> <body onload="init();"> <script language="javascript"> Ti.App.addEventListener("app:getSize", function(e) { alert(e.message); }); </script> </body> </html>
1 Answer
You are firing the event before the webview is loaded. This will never work, try load
Your Answer
Think you can help? Login to answer this question!