Method One: You have two options to create at the beginning of the nsmutableurlrequest and load, with Web view loadreqest or take over your application with Nsurlprotocol full URL loaded.
The easiest way to do this is to have the first choice of code as its only extra line: (validated)
-(BOOL) WebView: (UIWebView *) WebView shouldstartloadwithrequest: (nsurlrequest *) Request Navigationtype: ( Uiwebviewnavigationtype) navigationtype
{
nsmutableurlrequest *mutablerequest = [request mutablecopy];
NSString *sendparam = [[NSString alloc] InitWithData:mutableRequest.HTTPBody encoding:nsutf8stringencoding];
if (![ Sendparam isequaltostring:@ ""]) {
NSString *newdata = [Sendparam md5value];
Nsuinteger length = [NewData length];
[Mutablerequest addvalue:[nsstring stringwithformat:@ "%ld", length] forhttpheaderfield:@ "felength"];
request = [mutablerequest copy];
} else{return
YES
}
[Self.webview loadrequest:request];
Return YES
}
Method Two: Choose to use Nsurlprotocol to take over you this involves registering your own solution, using the URL of the application to create a specific class to load. The main method of rewriting is canonicalrequestforrequest.
I suggest you take a look at both tutorials Nsnipster and Raywenderlich for the guide. (not validated)