
Checks if a document (specified either by a URL address or a MIME type) is supported by the device, i.e. if the specified document can be displayed.
| Name | Description | Type | Use |
|---|---|---|---|
| url | A URL address of the file. Use "undefined" to indicate that the
mimeType (from the "options" object below) should be
checked. |
string |
required |
| options | Configuration passed to the function call, as described below the table. | object |
required |
| callbacks | Passed to verify whether there is an external application that can open that particular file type. | undefined |
required |
The canOpen method's options object looks like in
the following example.
{ mimeType, preview, timeout, authenticationType, username, password }| Name | Description | Type | Use |
|---|---|---|---|
| mimeType | A MIME type to be checked. If this property is specified, the
url must be null or not defined. |
string |
required |
| preview | If set to true, the API will check if a preview of that file type is possible (instead of looking for an external application). This property is supported on iOS only and its default value is "false". | boolean |
optional |
| timeout | A server response timeout (in seconds). It is used only if http(s)-based URL address has been specified. The default value of this property is "60". | integer |
optional |
| authenticationType | Specifies the function's behavior when HTTP basic authentication is requested. The setting's default value is "AUTHENTICATION_ANONYMOUS". Other possible settings are listed in the Constants section of the DocumentViewer article. | string |
optional |
| username | An optional username used when HTTP basic authentication is requested. The value is
passed only if authenticationType is set to
"AUTHENTICATION_CUSTOM_CREDENTIALS". |
string |
optional |
| password | An optional passoword used when HTTP basic authentication is requested. The value is
passed only if authenticationType is set to
"AUTHENTICATION_CUSTOM_CREDENTIALS". |
string |
optional |
The canOpen method's callbacks object can be
structured as follows:
{
onResult: function(result) {...},
onFailure: function(error) {...}
}The table below lists all callbacks supported by the method.
| Name | Description | Return type |
|---|---|---|
| onResult | Called when the function finishes without an error. The result
parameter passed in this callback is a boolean value specifying
whether the file can be opened or not. |
undefined |
| onFailure |
Called when an error occurs. The |
undefined |