I have a piece of html that I render in a UIWebview. The html is stored locally, but img
tags embedded in it refer to a remote server.
I would like the img
request to be accompanied by two cookies that contain auth information.
I am setting
[[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];
in my app delegate's applicationDidBecomeActive:
, and I'm adding the cookies to the cookie jar in a post-login step with [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:cookie];
(the cookie domain matches the host that serves the images).
When I debug the UIWebView with [webView stringByEvaluatingJavaScriptFromString:@"alert(document.cookie)"];
in webViewDidFinishLoad:
I see an alert with the contents "/".
Firstly, why does the cookie alert contain a single slash?
Secondly, am I doing the right things to send cookies with the image request in the UIWebView?
Thanks In Advance.