I have a simple iPhone app which will display html content I have placed in the Documents directory, but once it is displayed, the links do not work.
The following code is called from the init method of my app delegate.
Can anyone suggest what I have missed please?
-(void) loadWebView:(NSString*) appDirectory {
CGRect rect = CGRectMake(0, 0, 320, 480);
webView = [[UIWebView alloc] initWithFrame:rect];//init and create the UIWebView
[webView setBounds:rect];
// NSString* webViewFile = [appDirectory stringByAppendingString:@"index.html"];
// NSString* protocol=@"file://";
// NSString* fullUrl=[protocol stringByAppendingString:webViewFile];
fullUrl=@"http://www.google.com";
NSLog(@"Attempting to open url (unencoded) %@", fullUrl);
fullUrl = [fullUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSLog(@"Attempting to open url (encoded) %@", fullUrl);
//Create a URL object.
NSURL *url = [NSURL URLWithString:fullUrl];
//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
webView.delegate=self;
[webView loadRequest:requestObj];
window = [[UIWindow alloc] init];
[window addSubview:webView];
[window makeKeyAndVisible];
window.hidden=NO;
}