This simple code
var iframe = document.createElement('iframe'); document.documentElement.appendChild(iframe);
the entered UIWebView stringByEvaluatingJavascriptFromString calls the UIWebViewDelegate shouldStartLoadWithRequest using about:blank . Interestingly, mainDocumentURL set in the document that was there during the injection. For me, this means that I cannot enter such code whenever I want - re-inclusion in shouldStartLoadWithRequest , as a rule, breaks a lot of things. I can reject all about:blank requests (return NO from shouldStart... ), and code snippets from the Internet make this elusive, but this is hardly a systematic solution.
Any ideas why UIWebView has this confusing and useless behavior?
source share