3

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?

rishi
  • 11,779
  • 4
  • 40
  • 59

1 Answers1

2

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.

rishi
  • 11,779
  • 4
  • 40
  • 59
  • 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 – Rakesh Mandloi Mar 29 '18 at 10:20
  • after loading HTML, you want to change header fields in shouldStartLoadRequest? – rishi Mar 29 '18 at 12:53
  • 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. – Rakesh Mandloi Apr 02 '18 at 05:32