8

Is there a Objective C interface/programmatic API to WKWebView that allows one to increase the size limit of a domain's localStorage? When I debug the embedded browser the created by the iOS Framework using the script below, I get a DOMException with the message QuotaExceededError: DOM Exception 22 at approximately 2750KB of storage.

    function gen(n) {
        return new Array((n * 1024) + 1).join('a')
    }

    // Determine size of localStorage if it's not set
    var i = 0;
    try {
        // Test up to 10 MB
        for (i = 0; i <= 10000; i += 250) {
            localStorage.setItem('test', gen(i));
        }
    } catch (e) {
        console.log(e.message + ' : ' + i + 'KB size limit'); 
    }

One can recreate the same error by running the script in Safari. Though I can understand why it would be desirable to disallow a script running in the browser itself to set the size through JavaScript, there must be a programmatic API in WebKit to modify this.

Eternal Rubyist
  • 3,445
  • 4
  • 34
  • 51
  • 1
    Where you able to solve this problem by any chance? – Etienne Noël Sep 13 '18 at 17:04
  • I would like to know that answer to this question, and also if the app cache limit can be increased. Safari provides an alert box to increase the limit when it has been reached, but there is no documentation about how to do this in a WKWebView. – MichaelB Nov 20 '18 at 19:22
  • This is still an issue in 2022. Did anybody find a solution for it? – Holtwick Nov 03 '22 at 14:25

0 Answers0