开发者

UIWebView supporting both internal (stays in webview) and external (safari) links

I have an ipad app which acts as an ebook. It's basically a bunch of html pages linked together. I also have some external links which have been opening in the webview, but I now want to open in Safari.

I have implemented this method:

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request    navigationType:(UIWebViewNavigationType)navigationType 
{
    if(navigationType ==  UIWebViewNavigationTypeLinkClicked)
   {
        [[UIApplication sharedApplication] openURL:request.URL];
        return NO;
    }
    else 

        return YES;
}

Now my external links work and also my archor navigations tags (for some reason):

<a href="http://www.TheFOA.org">www.TheFOA.org</a>
<a href="#top">Back To Top</a>

But my internal links no longer work:

<a href="toc.html" target="TOC">Table Of Contents</a>

Is there a way that I can change my internal (or external) links to specify one or the other as UIWebViewNavigationTypeO开发者_如何转开发ther? And how do I go about doing this? Ideally, if I have change any html, there are a lot less external links.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜