How to save browsing history of UIwebview

孤者浪人 提交于 2019-12-06 07:49:35

Following code for the backward and forward into UIWebViewController

 - (IBAction)backButtonClicked:(id)sender {
      [webView goBack];
    }

    - (IBAction)backButtonClicked:(id)sender {
      [webView goForward];
    }
Paresh Navadiya

UIWebView has goBack and goForward method. Refer [here].(http://developer.apple.com/library/ios/#documentation/uikit/reference/UIWebView_Class/Reference/Reference.html)

Don't forget to add UIWebViewDelegate in .h and its object delegate to self.

Also can store url in NSMutableArray like this:

- (BOOL) webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
    NSURL *documentURL = request.mainDocumentURL;

    if(![history containsObject:documentURL.absoluteString]){
        [arrBrowseHistory addObject:documentURL.absoluteString];
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!