As you can add your own Javascript to your UIWebView web page, you can enter a pad layer for Ajax calls after loading the start page.
In this mode, you load a custom URL that you can find in your UIWebView based on an Ajax call. When the delegate sees a fake URL, you record an Ajax call, but return that the download should not happen. Then you iterate over the Ajax source code, so everything works.
So, although you cannot detect Ajax calls, you can detect URL requests.
The following answer has everything you need: UIWebViewDelegate not tracking XMLHttpRequest?
** Update **
, . URL-, readyState
http "//". .
, Ajax , UIWebView:
1) URL- mpAjaxHandler://URL
2) Ajax send() URL- mpAjaxHandlerDone://readyState: httpstatus/URL
, , ReadyState 4 HTTP- 200 .
, javascript , UIWebView , .
var s_ajaxListener = new Object();
s_ajaxListener.tempOpen = XMLHttpRequest.prototype.open;
s_ajaxListener.tempSend = XMLHttpRequest.prototype.send;
s_ajaxListener.callback = function () {
console.log('mpAjaxHandler://' + this.url);
window.location='mpAjaxHandler://' + this.url;
};
s_ajaxListener.callbackDone = function (state,status) {
console.log('mpAjaxHandlerDone://' + state + ':' + status + '/' + this.url);
window.location='mpAjaxHandlerDone://' + state + ':' + status + '/' + this.url;
};
function override_onreadystatechange(){
s_ajaxListener.callbackDone(this.readyState);
this.original_onreadystatechange();
}
XMLHttpRequest.prototype.open = function(a,b) {
if (!a) var a='';
if (!b) var b='';
s_ajaxListener.tempOpen.apply(this, arguments);
s_ajaxListener.method = a;
s_ajaxListener.url = b;
if (a.toLowerCase() == 'get') {
s_ajaxListener.data = b.split('?');
s_ajaxListener.data = s_ajaxListener.data[1];
}
}
XMLHttpRequest.prototype.send = function(a,b) {
if (!a) var a='';
if (!b) var b='';
s_ajaxListener.tempSend.apply(this, arguments);
if(s_ajaxListener.method.toLowerCase() == 'post')s_ajaxListener.data = a;
s_ajaxListener.callback();
this.original_onreadystatechange = this.onreadystatechange;
this.onreadystatechange = override_onreadystatechange;
}
, loadDoc() W3Schools javascript. http://www.w3schools.com/ajax/tryit.asp?filename=tryajax_first. , window.location=
.
, .