How to cache content in UIWebView for faster loading later on?

后端 未结 4 998
醉话见心
醉话见心 2020-11-27 15:02

I notice that the iphone safari caches content so that your page load for later is much faster much like a desktop browser. So take mobile gmail web page for example, the fi

4条回答
  •  醉话见心
    2020-11-27 15:14

    NSString *stringurl=[NSString stringWithFormat:@"http://www.google.com"];
    NSURL *url=[NSURL URLWithString:stringurl];
    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReturnCacheDataElseLoad timeoutInterval:15.0];
    [uiwebview loadRequest:theRequest];
    

    It will load a url first time then looks for for only the content changes..,if there is no updates in the url content it will load from the cache(local storage).

提交回复
热议问题