views:

26

answers:

0

I have a UIWebView with a UINavigationBar, that shows a UIButton to turn back to the previous page. This code works well with link of type <a href>, but not with location.href.

How can I do to make it works?

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)r navigationType:(UIWebViewNavigationType)navigationType
{
    if (webViewUnlinked){
        return YES;
    }


    [self setUserInteractionEnabled:NO];

    // if the user wants to go to a completely new page, we add the current page
    // to the path stack and then silently load the new page.
    if ((navigationType == UIWebViewNavigationTypeLinkClicked) || (navigationType == UIWebViewNavigationTypeBackForward))
    {
        [container createNewPageForRequest: r];
        return NO;
    }
    else 
    {
        self.request = r;
        [container pageLoadStarted];
       return YES;
    }
}