All Products
Search
Document Center

SuperApp:Code scanning

Last Updated:Jun 02, 2026

The WVScan JavaScript API lets you launch a QR code or bar code scanner from HTML5 apps and miniapps.

WVScan.scan

Note

This API requires WindVane Android 1.0.3.4 or later, or WindVane iOS 2.1.4 or later.

Launches the code scanner. Results are delivered via both a direct callback and DOM events — register event listeners before calling the API.

Sample code

document.addEventListener('WVScan.Event.scanSuccess', function (e) {
        alert('event scanSuccess: ' + JSON.stringify(e.param));
});
document.addEventListener('WVScan.Event.scanFailed', function (e) {
        alert('event scanFailed: ' + JSON.stringify(e.param));
});

var params = {
  openFlight: true,
  title: 'XXX'
};
window.WindVane.call('WVScan', 'scan', params, function(e) {
}, function(e) {
        alert('failure: ' + JSON.stringify(e));
});

Input parameters

Parameter

Type

Required

Description

openFlight

boolean

No

Specifies whether to enable the flash. true enables the flash; false disables it. Default: false.

title

string

No

The title of the scanning page. Default: "scan QR code or bar code".

compatible

boolean

No

Set to true when calling this API after a miniapp is presented.

  • [boolean ]openFlight: optional. Specifies whether to enable the flash. true enables the flash; false disables it. Default: false.

  • [string ]title: optional. The title of the scanning page. Default: "scan QR code or bar code".

  • [boolean] compatible: optional. Set to true when calling this API after a miniapp is presented.

Callback parameters

Success callback:

  • No callback parameters. Use the WVScan.Event.scanSuccess DOM event to retrieve the scan result.

Failure callback:

  • [string]msg: the error message.

Event listening

WVScan.Event.scanSuccess: The code is scanned.

Event parameters:

  • [string]content: the decoded content of the scanned code.

  • [string]format: the bar code format. Valid values:

    • [string]QR_CODE: QR code.

    • [string]AZTEC: Aztec 2D bar code.

    • [string]CODABAR: Codabar bar code.

    • [string]CODE_39: Code 39 bar code.

    • [string]CODE_93: Code 93 bar code.

    • [string]CODE_128: Code 128 bar code.

    • [string]DATA_MATRIX: Data Matrix 2D bar code.

    • [string]EAN_8: EAN-8 bar code.

    • [string]EAN_13: EAN-13 bar code.

    • [string]ITF: Interleaved 2 of 5 (ITF) bar code.

    • [string]MAXICODE: MaxiCode hexagonal 2D bar code.

    • [string]PDF_147: PDF417 2D bar code.

    • [string]RSS_14: RSS 14 bar code.

    • [string]RSS_EXPANDED: RSS Expanded bar code.

    • [string]UPC_A: UPC-A bar code.

    • [string]UPC_E: UPC-E bar code.

WVScan.Event.scanFailed: Code scanning failed.

Event parameters:

  • [string]msg: the error message.

Supported bar code formats

Enum value

Format

Type

QR_CODE

QR code

2D

AZTEC

Aztec

2D

DATA_MATRIX

Data Matrix

2D

PDF_147

PDF417

2D

MAXICODE

MaxiCode

2D

CODE_39

Code 39

1D

CODE_93

Code 93

1D

CODE_128

Code 128

1D

CODABAR

Codabar

1D

ITF

Interleaved 2 of 5 (ITF)

1D

EAN_8

EAN-8

1D

EAN_13

EAN-13

1D

UPC_A

UPC-A

1D

UPC_E

UPC-E

1D

RSS_14

RSS 14

1D

RSS_EXPANDED

RSS Expanded

1D