Skip to main content
JavaScript Bridge1 min read

Bridge Calls From Links (URL Protocol)

Call simple native methods from plain links with wapp:// URLs, receive results with a callback, and send several commands at once.

Overview

Some simple bridge methods can be called from a link instead of JavaScript, for example from an email template or a CMS that strips scripts.

html
<a href="wapp://haptics/trigger?params=%7B%22style%22%3A%22impactHeavy%22%7D">Buzz</a>

The format is wapp://<module>/<method>?params=<URL-encoded JSON>.

Only methods without personal data or native screens:

LinkMethod
wapp://core/deviceInfoDevice info (use a callback to receive it)
wapp://haptics/triggerVibration
wapp://appReview/prompt, wapp://appReview/openStoreListingRating prompt, store page
wapp://barcode/setPromptScanner text
wapp://firebaseAnalytics/logEventAnalytics event
wapp://crashlytics/logCrashlytics log line

Sign-in, payments, contacts and anything else that returns or sends personal data need JavaScript.

Receive the result

Add "callback" with the name of a global function to the parameters:

html
<script>
  function onInfo(result) { console.log(result.platform); }
</script>
<a href="wapp://core/deviceInfo?params=%7B%22callback%22%3A%22onInfo%22%7D">Show device</a>

Several commands

wapp://nativebridge/multi?data=<URL-encoded JSON array> runs up to 20 commands, each { "module", "method", "params" }.

Rules

  • Links follow the same Website access rules as JavaScript calls.
  • The older wsta:// and ctn:// schemes still work.

Next steps