Qt World Summit: Submit your Presentation

LocalStorage and Javascript Interface support

  • Hi,

    I'm working on the hybrid application with Qt. WebKit supports both localStorage and javascriptInterface, but I have no idea how to achieve similar features when deploying application for Android or iOS (which forces to use webview). Is there any way to make those features work? If not, do we know when they'll become available?

    Thanks in advance,

  • @amorawski Hi,

    if anybody would be interested in this - I didn't find any other way then by using native system browsers. Basically you need to extend the QQuickItem, then on iOS you can create the browser using ObjectiveC (using PlatformNativeInterface), on Android you need to use JNI (so you create native view on top of the QtView). Cool thing is that even animations work in both cases (on android you need to synchronize WebView position with the QQuickItem position beeing rendered on the QtView).

    For communication with javascript - for android you can use addJavascriptInterface, for iOS the best solution I have found is passing the params though URL on hidden iframe, and catching Load event on native side, fetching params from the URL).