How to get a cookie using the lens-c

advertisements

I'm converting a java applet program to ipad version.

In the original java applet code, there are some code to get cookie from javascript:

    JSObject browser = (JSObject) JSObject.getWindow(this);
    JSObject document =  (JSObject) browser.getMember("document");
    String cookie = (String)document.getMember("cookie");

So, how can I get this cookie using objective-c? Are there any similar classes or methods that can do the same thing? Thanks. :)

========UPDATE========

NSString *cookie = [webView stringByEvaluatingJavaScriptFromString:@"document.cookie"];

using this method can read values from javascript code


Check out the NSHTTPCookieStorage documentation.