Learn about the User-Agent (UA) format and JavaScript API call specifications for WindVane miniapps.
UA specifications
WindVane appends a WindVane tag, its SDK version, client-specific User-Agent (UA), and screen resolution to the default UA string for environment detection.
A complete UA contains the following space-separated elements: default UA (app name or version), WindVane or WindVane SDK version, additional client UA, and resolution (WxH).
Sample Android UA:
Mozilla/5.0 (Linux; Android 10; TAS-AN00 Build/HUAWEITAS-AN00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/88.0.4324.93 Mobile Safari/537.36 TTID/aaa WindVane/8.5.0
Sample iOS UA:
Mozilla\/5.0 (iPhone; CPU iPhone OS 15_5 like Mac OS X) AppleWebKit\/605.1.15 (KHTML, like Gecko) Mobile\/19F70 AliApp(EMASDemo\/2.0.0) WindVane\/8.6.1 TBIOS 1170x2532
-
On iOS, use the setAppUA method to configure the additional client UA. Use lowercase
xin the resolution field. -
On Android, no method is provided to configure the additional client UA. Use uppercase
Xin the resolution field.
Do not use the additional client UA to determine the OS and version of the client.
JavaScript API specifications
Call client features with window.WindVane.call(className, methodName, params, successCallback, failureCallback, timeout).
JavaScript APIs do not work inside iframes.
Input parameters
|
Type |
Parameter |
Description |
|
|
className |
Client class to call. |
|
|
methodName |
Client method to call. |
|
|
params |
Parameters to pass to the client. |
|
|
successCallback |
Callback on successful JSBridge call. |
|
|
failureCallback |
Callback on failed JSBridge call. |
|
|
timeout |
Optional. JSBridge call timeout. On timeout, the callback receives |
Both successCallback and failureCallback are invoked by native code. Place
This topic uses the className.methodName format to specify client class and method names.
Callback parameter: A successful client API call triggers the success callback; a failed call triggers the failure callback. Callback parameters vary by API.
ret in the callback parameter: Callback parameters may include a ret property that indicates the call status. Valid values:
|
Value |
Description |
|
|
API call succeeded. Returned only in |
|
|
JSBridge is forcibly disabled. Typically caused by the page URL not being in the trusted domain list, or JSBridge not being enabled for the native app. Verify the URL or contact the HTML5 container-native developers. |
|
|
The client does not support this API. Verify the JSBridge call and contact the native app provider. |
|
|
Invalid input parameter. |
|
|
The page lacks permission to call this API. |
|
|
API call failed. Contact the native app provider to troubleshoot. |
|
|
An error occurred during the API call. Contact the native app provider to troubleshoot. |
|
|
The API lacks the required permissions. For example, the client tried to access the album but was denied. |
|
|
The user canceled the API request. |
|
|
The user canceled the photo capture request from the WVCamera API. |
|
|
JSBridge call timed out. |
|
|
Invalid data format passed from the native app to HTML5. |
|
|
The current environment is not WindVane (for example, a browser), the client-provided WindVane UserAgent is invalid, or page JavaScript incorrectly modified an environment variable in windvane.js (for example, setting |
|
|
JSBridge was called on an unsupported device or environment (for example, a browser), or page JavaScript incorrectly modified an environment variable in windvane.js (for example, setting |
|
|
JSBridge was called on a Windows device or an unsupported environment (for example, a browser). |
|
|
Invalid data format passed from the native app to HTML5. |
The ret value varies by API and can be an empty string, a string, or an array. ret[0] contains the client API execution state. Not all APIs invoke callbacks — callback behavior depends on the client implementation. Each API's documentation specifies when success or failure callbacks occur.