Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Sample of Eval JS?

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

— asked October 26th 2010 by Karthikeyan Chandran
  • android
  • webview
0 Comments

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] );
        }
    });
    
    — answered November 16th 2010 by Aaron Saunders
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.