3

I want to detect if browser supports webSQL, in the same way we can check for indexedDB like below

if ( window.indexedDB ) {
    // indexedDB support is available
}
New Coder
  • 117
  • 2
  • 12

1 Answers1

2

Modernizr only checks if "openDataBase" is available on window:

const supports_webSQL = ("openDatabase" in window);

console.log( "supported:", supports_webSQL );
Kaiido
  • 123,334
  • 13
  • 219
  • 285
  • thanks a lot for your answer @Kaiido, can you please tell me if this solution is cross browser compatible? – New Coder Jan 09 '20 at 07:21
  • Well there is nothing fancy in there, so yes I guess it's quite safe to use from Netscape, if you replace `const` with `var`. But it makes me think that my stricter version could actually lead to errors being thrown in some cases. – Kaiido Jan 09 '20 at 07:27