All Products
Search
Document Center

SuperApp:WVBase

Last Updated:May 27, 2026

JavaScript APIs for the WVBase class. Use these APIs to copy text to the clipboard, set the WebView background color, check whether apps are installed, and verify API support in the current SDK version.

WVBase.copyToClipboard

Copies text to the clipboard.

Input parameters

  • [string] text: The text to copy.

Callback parameters

No callback parameters are returned. The success callback is invoked when the text is copied successfully; otherwise, the failure callback is invoked.

var params = {
        text: "text to copy"
};
window.WindVane.call('WVBase', 'copyToClipboard', params, function(e) {
        alert('success' + JSON.stringify(e));
}, function(e) {
        alert('failure' + JSON.stringify(e));
});

WVBase.isInstall

Checks whether a specified app is installed.

Note

On iOS 9 or later, this check works only if the app's scheme is declared in the LSApplicationQueriesSchemes key of the info.plist file.

Input parameters

  • [string] ios: The app identifier for iOS — the URL scheme. For example, 'taobao://'.

  • [string] android: The app identifier for Android — the package name. For example, 'com.taobao.taobao'.

Callback parameters

No callback parameters are returned. The success callback is invoked if the app is installed; otherwise, the failure callback is invoked.

var params = {
        // The app identifier for iOS.
        ios: 'taobao://',
        // The app identifier for Android.
        android: 'com.taobao.taobao'
};
window.WindVane.call('WVBase', 'isInstall', params, function(e) {
        alert('success');
}, function(e) {
        alert('failure');
});

WVBase.isAppsInstalled

Checks whether multiple apps are installed.

Note

On iOS 9 or later, this check works only if each app's scheme is declared in the LSApplicationQueriesSchemes key of the info.plist file.

Input parameters

  • [object] An object that maps unique app names (such as taobao) to objects with the following properties:

    • [string] ios: The app identifier for iOS — the URL scheme. For example, 'taobao://'.

    • [string] android: The app identifier for Android — the package name. For example, 'com.taobao.taobao'.

Callback parameters

The success callback receives an object with the results. The failure callback is invoked on error.

  • [object] An object that maps each input app name to a boolean: true if the app is installed, false otherwise.

var params = {
        taobao: {
                ios: 'taobao://',
                android: 'com.taobao.taobao'
        },
        tmall: {
                ios: 'tmall://',
                android: 'com.tmall.tmall'
        }
};
window.WindVane.call('WVBase', 'isAppsInstalled', params, function(e) {
        alert('success: ' + JSON.stringify(e));
}, function(e) {
        alert('failure: ' + JSON.stringify(e));
});

WVBase.notify

Note

This API is available on iOS only.

Dispatches a custom event on the document object with the specified parameters.

Input parameters

  • [string] event: The name of the event to dispatch.

  • [object] param: The object to pass with the event.

Callback parameters

This method does not invoke the success or failure callbacks and returns no callback parameters.

Event listening

The event name is specified by event, and the event data is the object specified by param.

document.addEventListener('MyNotifyName', function(e) {
        alert(JSON.stringify(e.param));
}, false);

var params = {
        // The name of the event to trigger.
        event: 'MyNotifyName',
        // The parameters for the event.
        param: { MyEventParam: 'paramValue' }
};
window.WindVane.call('WVBase', 'notify', params);

WVBase.openBrowser

Note

This API is available on iOS only.

Opens a URL in a new Safari window.

Input parameters

  • [string] url: The URL to open in Safari.

Important

Use this API only when you need to force a URL to open in Safari. For standard navigation, use an <a> tag, location.href, or an iframe's src attribute instead.

Callback parameters

No callback parameters are returned. The success callback is invoked when the URL opens successfully; otherwise, the failure callback is invoked.

var params = {
        // The URL to display in the browser.
        url: 'http://www.baidu.com'
};
window.WindVane.call('WVBase', 'openBrowser', params, function(e) {
}, function(e) {
        alert('failure: ' + JSON.stringify(e));
});

WVBase.setBackgroundColor

Note

This API is available on iOS only.

Sets the background color of the WebView.

Input parameters

  • [string] color: The hexadecimal color code for the WebView background color. Accepts the 0x or # prefix.

  • [number] alpha: Optional. The opacity of the WebView background. Accepts values from 0 to 1.

Callback parameters

No callback parameters are returned. The success callback is invoked on success; otherwise, the failure callback is invoked.

var params = {
        color: 'FF0000',
        alpha: 0.3
};
window.WindVane.call('WVBase', 'setBackgroundColor', params, function(e) {
        alert('success: ' + JSON.stringify(e));
}, function(e) {
        alert('failure: ' + JSON.stringify(e));
});

WVBase.canIUse

Note

This API is available in WindVane for Android 1.0.3.4 and later.

Checks whether a specified API or method is supported by the current SDK version.

Input parameters

  • [string] api: The API class name, such as WVBase or WVMotion.

  • [string] method: Optional. The method name within the API class, such as isWindVaneSDK or copyToClipboard. If omitted, only the API class availability is checked.

Callback parameters

  • [boolean] canUse: true if the specified API or method is supported; false otherwise.

var params = {
        api: 'WVMotion',
        method: 'vibrate'
};
window.WindVane.call('WVBase', 'canIUse', params, function(e) {
        alert('success: ' + JSON.stringify(e));
}, function(e) {
        alert('failure: ' + JSON.stringify(e));
});

WVMiniApp.close

Closes the miniapp.

Input parameters

None.

Callback parameters

None.

window.WindVane.call('WVMiniApp', 'close', {}, function(e) {
  			alert('success');
}, function(e) {
  			alert('failure');
});