Monday, June 3, 2013

UIWebView goBack example in Objective C (iOS).


UIWebView goBack

Loads the previous location in the back-forward list.

- (void)goBack

UIWebView goBack example.
Sample code:

if ([webView canGoBack]) {
    [webView goBack];
}

Example of [UIWebView goBack].
NSString *urlAddress = @"http://www.stackoverflow.com";

 NSURL *url = [NSURL URLWithString:urlAddress];

 NSURLRequest *requestObj = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:60];

 [self.webview loadRequest:requestObj];
and then try your back navigation:

 [self.webview goBack]; 

End of UIWebView goBack example article.