问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/24682722/how-to-set-http-header-in-uiwebview-if-loading-view-with-loadhtmlstring