Are you having the same problems I am with Webviews?
I am using Titanium 1.21 and Android 2.1.
To summarize the main problems I am facing:
1) Cannot get data from a webview to app.js
I've spent 2 days on this now, and nothing works. If I try to use evalJS, I get a forced close in the emulator. If I try to simply define a variable in the window like win1.something='abcd', I cannot retrieve it inside the webview.
2) Fireevent gets fired at least 2 times
This has been in the forum for a few weeks now, any idea when it's going to get fixed?
Anyone knows the status of these?
2 Answers
-
i have/had a simlar issue took 3 days to figure it out, with not luck from the forum.
I used something like this. (basiclly a details screen pushing data to a webview. I'm sure you could reverse itwebview.addEventListener('load', function() { Ti.App.fireEvent('pageReady',{id:MyVar}); // sets the var to pass }); w.add(webview); w.open(); .... more code here
then in the HTML page in the <script> tags I used:
Ti.App.addEventListener('pageReady',function(e) // catches the passed var { alert('the id is' + id); // shows ID idin debugger. id = (set var here) {
Not sure if this will help, I can't seem to find the example I used to refer to.
Hope it helps
-
But why should we work with ugly workarounds, if this feature should work on both platforms the same, according to Passind Data section in window documentation
i have this feeling that the iPad hype will let us wait long for a fix of this obvious bug in android implementation. And thats maybe the answer why we need ugly workarounds ;)
someone else an idea?
thx, bye.