Back / Forward buttons for UIWebView - canGoBack does not work with ajax sites

I use some toolbar buttons to go back and forth through historical web pages in UIWebview. enter image description here

I turn on / off these buttons with the help [webview canGoBack]called in webViewDidStartLoad. It works fine on most sites, but the problem is that on sites like Twitter and facebook that use javascript / ajax requests to reload new pages canGoBackand canGoForwarddo not recognize the page change so that my buttons do not activate.

Is there any way around this?

+5
source share
3 answers

webView: shouldStartLoadWithRequest: navigationType:

- (BOOL)webView:(UIWebView *)myWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType;

"". , .

+1

, back/forward AJAX. - URL- .

. http://www.devx.com/webdev/Article/35549 .

, - -, ( javascript-, ), - .

+1
  • (void) webViewDidStartLoad: (UIWebView *) webView {

    [SVProgressHUD showWithStatus: @ "..." ];

    if (webView.canGoBack) {self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView: btnBack]; } else {self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] init]; }}

0
source

All Articles