Developers » Client API methods
1. showInstallBox
Parameters:
Limits: no more than once in 3 seconds.

Opens a window with permission request to install the application. User consent calls the onApplicationAdded event.

Example Usage
VK.callMethod("showInstallBox");
2. showSettingsBox
Parameters: settings (integer)
Limits: no more than once in 3 seconds.

Opens a window with an application access permission request. The settings parameter is a bit mask of the requested access permissions. If settings = 0, a user will be prompted to allow all possible access permissions. Settings change calls the onSettingsChanged event. If the user clicks Cancel or closes the window, the onSettingsCancel event is called.

Example Usage
VK.callMethod("showSettingsBox", 8214);

Here settings = 8214 = 2 + 4 + 16 + 8192 = friends, photo, video, wall. A window with a permission request to access friends, photos, videos and wall is shown to the user.
3. showGroupSettingsBox
Parameters: settings (integer)
Limits: no more than once in 3 seconds.

Opens a window with an application access request to a community. The settings parameter is a bit mask of the requested access permissions. If settings = 0, the community will be prompted to allow all possible access permissions. Settings change calls the onGroupSettingsChanged event. If a user clicks Cancel or closes the window, the onGroupSettingsCancel event is called.

Example Usage
VK.callMethod("showGroupSettingsBox", 4096);

Here settings = 4096 = messages. Access permissions to communitys messages are requested.
4. showRequestBox
Parameters: user_id (integer), message (string), requestKey (string)
Limits:

Opens a window for sending a request to user_id (a friend of the current user) with a message and a random additional requestKey parameter. With this method the user can notify their friends about an event in the application even if they don't have it installed. When the recipient views the request, the following parameters are passed: request_key and request_id.

After the users action, one of the following three events can be called: onRequestSuccess, onRequestCancel, onRequestFail.

Example Usage
VK.callMethod("showRequestBox", 123456789, "Hello!", "myRequestKey");

Here the request with "Hello!" will be sent to the user with id 123456789.
5. showInviteBox
Parameters:
Limits:

Opens a window where a user can invite their friends to the application.

Example Usage
VK.callMethod("showInviteBox");
6. showOrderBox
Parameters: type (object)
Limits:

Opens a window for purchasing products in the application or charging votes to the apps account. See full description of the method here Payment dialog box.
7. showProfilePhotoBox
Parameters: photo_hash (string)
Limits:

Opens a window where a user can confirm photo changes on their page. The photo_hash parameter can be obtained by the photos.saveOwnerPhoto method. Users consent calls the onProfilePhotoSave event.

Example Usage
VK.callMethod("showProfilePhotoBox", "sdf87dfhsdfdfjererhfd9");
8. resizeWindow
Parameters: width (integer), height (integer)
Limits:

Initiates a change of the IFrame elements width and height. The maximum window width value is 1000 pixels and the height 4050 pixels. When the window sizes are changed, the onWindowResized event with new width and height values is called.

Example Usage
VK.callMethod("resizeWindow", 500, 500);
9. scrollWindow
Parameters: top (integer), speed (integer)
Limits:

Initiates vertical scrolling of a browser window. The top parameter sets the scroll offset from the zero coordinate of the window. For example, to scroll to the top of the window, the 0 value is necessary to be passed. The speed parameter sets animation speed in milliseconds and is 0 by default.

Example Usage
VK.callMethod("scrollWindow", 200, 500);
10. setTitle
Parameters: title (string)
Limits:

Changes the browser tab title.

Example Usage
VK.callMethod("setTitle", "New title");
11. setLocation
Parameters: location (string), fireEvent (bool)
Limits:

Changes hash of the current page URL which is written in the browser address bar after # symbol. It is used to support "Back" and "Forward" buttons in the browser. The fireEvent parameter defines whether the onLocationChanged event should be called immediately after the method is run.

Example Usage
VK.callMethod("setLocation", "new_location");
12. scrollTop
Parameters:
Limits:

Calls the onScrollTop event with four elements:
  • Current location of VK window scrolling
  • VK window height in the browser
  • Indent from the page beginning to the object with the application
  • Whether the current tab is active

Example Usage
VK.callMethod("scrollTop");
13. scrollSubscribe
Parameters: fireEvent (bool)
Limits:

Calls the onScroll event with the current scrolling location and window height after a user has scrolled the page. The fireEvent parameter defines whether the event should be called immediately after the method is run.

Example Usage
VK.callMethod("scrollSubscribe", true);
14. showInstallPushBox
Parameters:
Limits:

Opens a window for sending a link to the games mobile version. The onInstallPushSuccess event is called if the sending is successful.

Example Usage
VK.callMethod("showInstallPushBox");
15. showAllowMessagesFromCommunityBox
Parameters:
Limits:

Opens a window where a user can allow a community to send them messages. The onAllowMessagesFromCommunity event is generated when the access is granted. If the user clicks Cancel or closes the window, the onAllowMessagesFromCommunityCancel event is called.

Example Usage
VK.callMethod("showAllowMessagesFromCommunityBox");
16. callUser
Parameters: photo_hash (string)

Opens a window with a call in the app.
17. checkUnitySupport
Parameters:
Limits:

Checks the possibility of using Unity player in a user's browser and offers to install it if it's not. As a result the following events are called:
  • onCheckUnitySupportSuccess Unity is installed and can be used.
  • onCheckUnitySupportFail Unity is not installed (notification with a link to download Unity is shown).
18. checkFlashSupport
Parameters:
Limits:

Checks the possibility of using Flash player in a user's browser and offers to install it if it's not. As a result the following events are called:
  • onCheckFlashSupportSuccess Flash is installed and can be used.
  • onCheckFlashSupportFail Flash is not installed (notification with a link to download Flash is shown).
19. showSubscriptionBox
Parameters: item (string), subscription_id (integer)
Limits:

Opens a window for buying or canceling subscription in the application. See the complete description of this method here Subscription dialog window.

Note that if calling this method, the action that needs to be performed should be passed to callMethod as a second argument. Possible values:
  • create purchase subscription
  • resume renew subscription
  • cancel cancel subscription

Example Usage
VK.callMethod('showSubscriptionBox', 'create', {item: 'subscription1'});
20. showAppWidgetPreviewBox
Parameters: type (string), code (string)
Limits: no more than once in 30 seconds

Opens a window with a preview of a community app widget and a button to confirm its installation. type widget type (for example, "text"), code code that returns the widget object.

Returns one of the following events:
  • onAppWidgetPreviewFail an error occurred (for example, incorrect syntax in code).
  • onAppWidgetPreviewCancel widget installation canceled by a user.
  • onAppWidgetPreviewSuccess widget installation confirmed.

Example Usage
VK.callMethod('showAppWidgetPreviewBox', 'text', 'return {
    "title": "Quote",
    "text": "Quoted text"
};');