cordova-bridge/open

Open documents with compatible applications installed on the user's device.
cordova-bridge0.3.08
platforms: android,ios
$ cordova plugin add com.bridge.open

open

Open documents with compatible applications installed on the user's device.

Install

$ cordova plugin add com.bridge.open

Usage

The plugin exposes the following methods:

cordova.plugins.bridge.open(file, success, error)

Parameters:

  • file: A string representing a URI
  • success: Optional success callback
  • error: Optional error callback

Example

Default usage

// with a file uri
cordova.plugins.bridge.open('file:/storage/sdcard/dcim/camera/1404177327783.jpg');

// with a remote url
cordova.plugins.bridge.open('https://raw.githubusercontent.com/cordova-bridge/open/test/test.png');

With optional callbacks

var open = cordova.plugins.bridge.open;

function success() {
  console.log('Success');
}

function error(code) {
  if (code === 1) {
    console.log('No file handler found');
  } else {
    console.log('Undefined error');
  }
}

open('file:/storage/sdcard/DCIM/Camera/1404177327783.jpg', success, error);