cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Grieve <>
Subject Re: [Android] The state of WebSQL on Android 4.x
Date Thu, 19 Sep 2013 02:56:25 GMT
If it's easy to support, then I think it's worth doing.

A custom scheme would work, but I think we can do it with a less intrusive

We came up with the following hack during our chrome-apps-on-cordova work
for having CORS work when on a custom scheme. Should work for WebSQL as
well though. It takes advantage of the fact that file:/// pages can access
window objects of opened windows that are on different domains. It goes

The JS Code:

var win ="websql://ftw");
// wait for window to load. Maybe via onload event? Or via polling?
win.onload = function() {
  window.openDatabase = win.openDatabase;

// The Java code:

// In Chrome Client:
    private WebView newWebView = null;
    public boolean onCreateWindow (WebView view, boolean isDialog, boolean
isUserGesture, Message resultMsg) {
        WebView.WebViewTransport transport = (WebView.WebViewTransport)
        newWebView = new WebView(act);

        newWebView.setWebViewClient(new WebViewClient(){
                public WebResourceResponse shouldInterceptRequest(final
WebView view, String url) {
                        return a response that is just an empty page.
        return true;

On Wed, Sep 18, 2013 at 7:43 PM, Jesse <> wrote:

> Windows Phone has never supported it.  I have always felt that this is more
> of a browser responsibility and didn't belong in the 'phonegap features'
> matrix. Just like we don't list querySelectorAll or SVG support.
> Someone needs to write a JS shim that uses the File API which IS available
> on all the devices in cordova.
> @purplecabbage
> On Wed, Sep 18, 2013 at 2:31 PM, Joe Bowser <> wrote:
> > Ok, We've been ignoring this for quite a while, but it's not going away:
> >
> > There's still people who want to use WebSQL, and WebSQL is still
> > totally broken.  Part of the reason it's broken is the fact that
> > Android prevents us from using the official WebSQL API on file URIs,
> > and that we have a nasty collision with the official API on Android.
> >
> > So, what should we do?
> > 1. Use a custom URI scheme?
> > 2. Fix the JS so it aliases the existing WebSQL, and keep using our
> > own WebSQL plugin.
> > 3. Just say it's deprecated and leave it at that?
> >
> > If we say we're tossing WebSQL by the wayside, what do we support
> > instead?  Seriously, what do people think of this, because I'm not
> > sure what we should do here.
> >
> > Joe
> >

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message