Parent repository for Share plugin. Documentation and submodules with sources.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
Android @ c32b3e2
Web @ 26c8977
iOS @ 8210696

Share Plugin

Share plugin allows you to share content or files from the web or internal application data to other applications.

How to use

  • import the plugin to your project as explained here
  • Add the cobalt.share.js to your web JS folder
  • Add an html link to the cobalt.share.js plugin script after the cobalt link in the HEAD tag

Sharing files from JavaScript

use the cobalt.share shortcut like this:


or with a callback:

cobalt.share(myContent, function(result){...});

where data need a JSON Object like:

var myContent = {
'type': 'image',
'source': 'url',
'path': '',
'title': 'Cat', // optional
'detail': "playing with a goldfish" // optional


If you like to share:


var myContent = {
'type': 'text',
'title': 'alphabet'


var myContent = {
'type': 'contact',
'name': 'Jean Paul',
'mobile': "0102030405",
'email': '', // optional
'company': 'Cobaltians', // optional
'postal': '1 City Hall SQ, RM 612, Boston, etc.', // optional
'job': 'Human Resources', // optional
'detail': 'foo', // optional


var myContent = {
'type': 'image',
'source': 'url',
'path': '',
'title': 'Cat', // optional
'detail': "playing with a goldfish" // optional

4.Share a local document

The document must be stored in "app/src/main/assets/files/samples.pdf" (Android) or in iOS bundle

var myContent = {
'type': 'document',
'source': 'local',
'path': 'files/sample.pdf',

5.Share a remote video

var myContent = {
'type': 'video',
'source': 'url',
'path': "",
'title': 'big buck bunny', // optional

And then:


Existing fields to fill are :

Field Description Examples Values Mandatory
source source from where the file comes 'url', 'local' YES
path local/remote path of the file '', 'files/pixel.png' YES
type file type 'text', 'image', 'contact', 'document', 'audio', 'video', 'data' YES
name contact name 'Jean Paul' NO
mobile contact number '+33201050602' NO
email contact email '' NO
company contact company 'Jp Corp.' NO
postal contact postal '1 City Hall SQ, RM 612, Boston' NO
job contact job 'DRH' NO
title contact title 'This is something' NO
detail contact detail 'Some comments about this' NO

Want more ?

If you have any ideas or improvements to propose, please feel free to do so in the issues tracker!