IPhone development-- how to get bookmarks and history data from UIWebView?
As the description of title, Whic开发者_Go百科h interface of UIWebView should I call to get these data?
I don't think this is possible with the current API. You will have to maintain state i.e. track bookmarks and history data but that too from user's usage of your UIWebView
instance. You can't get the data of Mobile Safari. Although UIWebView
instance allows you to navigate back and forth indicating that it does maintain some sort of state, all of it is cloaked inside the UIWebViewInternal
class.
One way to maintain your own history is to implement the delegate method:
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
When the navigation type is UIWebViewNavigationTypeLinkClicked you can add it to your own history array.
精彩评论