Skip to content
Switch branches/tags
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

AQTest: asynchronous query from web worker to native Android code using XHR

Author: Christopher J. Brody

License: UNLICENSE (public domain)

I can hereby testify that this project is completely my own work and not subject to agreements with any other parties. In case of code written under direct guidance from sample code the link is given for reference. In case I accept contributions from any others I will require CLA with similar statements.


This project demonstrates the following:

  • Ability to request native iOS functionality from within a web worker and return a callback to the web worker.
  • Build a hybrid Javascript-native app without using a framework such as Cordova which requires attribution of use.

The interaction between Javascript and native Java works as follows:

  • The Javascript executes a simple XHR POST with a file: or custom URI
  • The Java sees URL request and triggers the Javascript aqcallback function with a string that echos the URI from the XHR request

This project also has an AQManager component that keeps and handles the routing for multiple components that implement the AQHandler interface.

This project is a starting point for the following ideas (so far):

  • Javascript-native interface that can be used from a web worker within Cordova, such as: @brodybits / cordova-aqs-android and @brodybits / cordova-aqs-ios
  • Provide a sqlite database access layer for Javascript that can be used within multiple Javascript-native bridging frameworks including Cordova, React Native, and NativeScript
  • Provide a public-domain Javascript-native access bridge

Security warning

The Cordova project has been fixing security issues in its external domain whitelist plugin over time, and has also dealt with security issues in its internal bridging mechanism. It is very strongly advised NOT to release an app with a custom-built web view bridging or domain whitelisting mechanism without proper code review and testing.

Other major limitations

  • There is no general message queueing. The idea is currently let each component implement its own queueing mechanism.

Related project(s)

A similar concept described in my Starting JSONBus: towards a replacement for Cordova/PhoneGap post on an old blog in December 2012.


Asynchronous Javascript query from web worker in WebView working for Android



No releases published


No packages published