Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (evaljs)
Viewing all articles
Browse latest Browse all 83

Asynchronous evalJS() result only on Android

$
0
0

I am trying to get the HTML of a webview and save it. I have, essentially, the following in my app:

Ti.API.info("save()");
Ti.API.info(1);
var body = view.evalJS("setupSave()");
Ti.API.info(2);
if (!body || body == "" || body == "undefined") {
    Ti.API.info("save(): no body");
}
Ti.API.info(3);
and, in my webview-loaded JS:
function setupSave()
{
    Ti.API.info("setupSave()");
    return document.body.innerHTML;
}
On iOS this works fine, and the output is:
[INFO] save()
[INFO] 1
[INFO] setupSave()
[INFO] 2
[INFO] 3
On Android, however, I get:
save()
1
2
save(): no body
setupSave()
Like that: no "3", and "setupSave()" comes after the "no body" message.

What could explain this out-of-order Ti.API.info() logging, to give me some idea of where to start looking?


Viewing all articles
Browse latest Browse all 83

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>