Note that there are some explanatory texts on larger screens.

plurals
  1. POWebView loads slowly in Mac OS
    primarykey
    data
    text
    <p>I have created plugin for Mail.app on Mac OS. I'm using WebView to display web pages, all would be fine but web pages load slowly.</p> <p>Then I created test cocoa application to compare loading time. I was surprised when the test application loads page ~5 times faster.</p> <p>In developer bar I saw my test application receives <a href="http://www.checkupdown.com/status/E304.html" rel="nofollow">304 code</a> that indicates "the resource for the requested URL has not changed and cached resource can be used". In contrast to the test application the plugin always receives 200 http code and loads resource again.</p> <p>Maybe I should specify to use a cache in the webview, or I have some bundle permissions problems.</p> <p>In the plugin, I tried to specify <code>SharedURLCache</code> like this</p> <pre><code>NSURLCache *cache = [[NSURLCache alloc] initWithMemoryCapacity:1024*1024*20 diskCapacity:1024*1024*5 diskPath:NSHomeDirectory()]; [NSURLCache setSharedURLCache:cache]; </code></pre> <p>Then I tried subscribe to the <code>ResourceLoadDelegate</code> on the WebView and change request object like this</p> <pre><code>- (NSURLRequest *)webView:(WebView *)sender resource:(id)identifier willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse fromDataSource:(WebDataSource *)dataSource { if ([request cachePolicy] != NSURLRequestReturnCacheDataElseLoad) { return [NSURLRequest requestWithURL:[request URL] cachePolicy:NSURLRequestReturnCacheDataElseLoad timeoutInterval:[request timeoutInterval]]; } else { return request; } } </code></pre> <p>Also I tried to change properties on WebView</p> <pre><code>[[webView preferences] setUsesPageCache:YES]; [[webView preferences] setCacheModel:WebCacheModelPrimaryWebBrowser]; </code></pre> <p>but it's all not working.</p> <p>Thanks for help.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload