JSFiddle - React, Tailwind, and code Playground
by popopome
HTML
<div id='a'></div>
JavaScript
function checkDbSize(sizeInBytes) {
try {
var shortName = 'sampledb' + new Date().getTime();
var version = "1.0";
var displayName = 'sample-database';
var maxSize = sizeInBytes;
var db = openDatabase(shortName, version, displayName, maxSize);
var $a = $('#a');
var html = $a.html();
html += "<br />" + sizeInBytes + " SUPPORTED";
$a.html(html);
return true;
} catch(err) {
var html = $a.html();
html += "<br />" + sizeInBytes + " NOT SUPPORTED";
$a.html(html);
return false;
}
}
$(function() {
var GB =1024*1024*1024;
var a = $('#a');
checkDbSize(256*GB);
});
/*
function storageInfoCallback(currentUsage, currentQuota) {
$('#a').html("Current usage:" + currentUsage+ ", currentQuota: " + currentQuota);
}
$(function() {
webkitStorageInfo.queryUsageAndQuota(
0,
storageInfoCallback
)
})
*/