[SOLVED] PhoneGapDelegate::shouldStartLoadWithRequest: Received Unhandled URL about:blank
Using ChildBrowser with PhoneGap on iOS: On iOS, the web view that PhoneGap provides doesn’t handle about:blank. After updating Xcode and iOS 5.1 SDK I began receiving the following error when I launched a browser on my actual device:
PhoneGapDelegate::shouldStartLoadWithRequest: Received Unhandled URL about:blank
Thanks to <a href=”http://www.jamesjoycewaskorean.com/#20110908150931″>James Joyce</a> for this fix:
The fix is twofold and will work for other plugins requiring about:blank too!
1) Create a file in the www folder called blank.html containing the markup below.
<html> <body> </body> </html>
Next, in AppDelegate.m in your Xcode project, find the following method.
- (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { return [ super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType ]; }
“This method is where one is able to rewrite requests on their way through. To rewrite about:blank to point to the blank.html file, it is first necessary to find the path to the www folder and thus to blank.html”
Replace that method with this:
- (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { NSURLRequest* req = request; if ([[[request URL] absoluteString] isEqualToString: @"about:blank"]) { NSLog(@"Rewriting about:blank"); NSString* app = [[NSBundle mainBundle] resourcePath]; NSString* blankpath = [NSString stringWithFormat: @"%@/www/blank.html", app]; NSURL* blankurl = [NSURL fileURLWithPath:blankpath]; req = [NSURLRequest requestWithURL: blankurl]; } return [ super webView:theWebView shouldStartLoadWithRequest:req navigationType:navigationType ]; }
This should allow web components that rely on about:blank to work correctly.

Join him as he learns and shares his experiences of marketing his own products online.
Subscribe via RSS
@EliotDill
Leave a Reply
You must be logged in to post a comment.