My iOS UIWebView page is based on Cordova open source framework, and I want to add some customize http headers in its webview URL request, my solution is to add them in the foll
You have two options either create a NSMutableUrlRequest at the start and load that with webView loadReqest or take over the complete URL loading of your app with NSURLProtocol.
The most easiest way is the first choice as its only one extra lines of code:
[webView loadRequest:mRequest];
The second choice uses NSURLProtocol to take over URL loading of your app. this involves registering your own solution using creating a concrete class. the main method to override is canonicalRequestForRequest
.
I suggest you take a look at these two tutorials NSNipster and raywenderlich for guides.