Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implementing a WebView database quota delegate

How do I implement this method (see below)? I'm new to Objective-C and I'm just not getting it right.

From: http://lists.apple.com/archives/Webkitsdk-dev/2008/Apr/msg00027.html

By default databases have a quota of 0; this quota must be increased before any database will be stored on disk.

WebKit clients should implement the WebUIDelegate method - webView:frame:exceededDatabaseQuotaForSecurityOrigin:database: and increase the quota as desired when that method is called. This method is defined in WebUIDelegatePrivate.h. It was added too late in the previous release cycle to make it into a non-private header. It would be worthwhile to file a bug about moving this call to WebUIDelegate.h so that it is part of the official API.

John

like image 724
Jeff Avatar asked Jul 10 '26 18:07

Jeff


1 Answers

In whatever class you've defined as the delegate for your WebView you need to implement that method, something like this:

- (void)webView:(WebView *)sender frame:(WebFrame *)frame exceededDatabaseQuotaForSecurityOrigin:(WebSecurityOrigin *)origin database:(NSString *)databaseIdentifier {
    unsigned long long newQuotaBytes = 10 * 1024 * 1024;
    [origin setQuota:newQuotaBytes];

    // origin also responds to -usage method to return current size for all databases in this origin
}
like image 100
Ashley Clark Avatar answered Jul 13 '26 15:07

Ashley Clark



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!