Sample of Eval JS?

You must Login before you can answer or comment on any questions.

Hi! Any provide the sample code to use evalJS function in android.

1 Answer

This is what I do on my iPhone & I just tested it on Android.

var webView = Ti.UI.createWebView({url:"http://www.google.com"});
win1.add(webView);
 
webView.addEventListener('load',function(e)
{
    var cookies = webView.evalJS("document.cookie").split(";"); 
    Ti.API.info( "# of cookies -> " + cookies.length  );
    for (i = 0; i <= cookies.length - 1; i++) {
            Ti.API.info( "cookie -> " + cookies[i] );
    }
});

Your Answer

Think you can help? Login to answer this question!