I have a UIWebView that i am loading using loadHTMLString and i need to set cookies on the request header. I know how to do this using loadRequest but not loading the webview with loadHTMLString I don't have the request object. Has anyone done anything like this?
-
1there will not be any difference between loading web view from loadRequest vs loadHTMLString method, shouldStartLoadWithRequest method will be called in both cases. You can override your headers there.rishi– rishi2014-07-10 17:30:24 +00:00Commented Jul 10, 2014 at 17:30
-
BOOM! that seemed to do the trick! thanks!Deprecated Darren– Deprecated Darren2014-07-10 17:45:11 +00:00Commented Jul 10, 2014 at 17:45
-
Good, might be this can be posted as answer and you can accept and close the question!!rishi– rishi2014-07-10 17:49:04 +00:00Commented Jul 10, 2014 at 17:49
-
@DeprecatedDarren please can you tell me how you do it?Rakesh Mandloi– Rakesh Mandloi2018-03-29 10:20:53 +00:00Commented Mar 29, 2018 at 10:20
Add a comment
|
1 Answer
There will not be any difference between loading web view from loadRequest vs loadHTMLString method, shouldStartLoadWithRequest method will be called in both cases. You can override your headers there and add header as per your requirements.
3 Comments
Rakesh Mandloi
i have the same issue while loading HTML string with loadHTMLString and than add header field in shouldStartLoadWithRequest and than load request my loaded HTML is getting blank
rishi
after loading HTML, you want to change header fields in shouldStartLoadRequest?
Rakesh Mandloi
Thanks for reply rishi, Yes I want but the issue is when is update header and then load request which is in shouldStartLoadRequest so my HTML is getting blank.