Reputation: 109
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
Upvotes: 0
Views: 1459
Reputation: 109
I found a way to get cookies.
NSString *cookie = [webView stringByEvaluatingJavaScriptFromString:@"document.cookie"];
using this method can read a value directly from javascript
Upvotes: 0