WebApp快捷打包
Facebook 分享
转到模块插件

敬告:此 DEMO 演示为开放测试页面,仅用于开发者快速测试体验应用功能,请严格遵守开发者协议,了解更多

JS-SDK 引用方式:

♦ 普通网页 script 方式加载:下载最新版 jsBridge-v20250826.zip,请在页面上调用 jsBridge 接口之前引用 jsbridge-mini.js 库;

♦ js module 方式引用:npm install ym-jsbridge 具体请参考 npm package

Facebook Share 分享

shareLink 链接

//客户端APP或Web分享
jsBridge.fbShare.shareLink({
  //其他公共参数
  //...
  //话题 the ShareHashtag for this content
  hashtag   : "#UkraineCrisis",
  //链接 the URL for the content being shared
  contentUrl: "https://m.baidu.com",
  //引用 the quote to display for this link
  quote     : "Connect on a global scale."
}, function(succ, data) {
  if (data.result == "success") {
    alert("成功:" + data.postId);
  } else if (data.result == "cancel") {
    alert("取消");
  } else if (data.result == "error") {
    alert("错误:" + data.message);
  } else {
    alert(JSON.stringify(data));
  }
});

/*
所有分享接口都支持的公共参数
{
    //链接 the URL for the content being shared
    //可选,字符串
    contentUrl: "https://m.baidu.com",
    //标记人 the list of Ids for taggable people to tag with this content
    //可选,字符串数组
    peopleIds : [],
    //位置 the Id for a place to tag with this content
    //可选,字符串
    placeId   : "",
    //页面 the Id of the Facebook page this share is associated with
    //可选,字符串
    pageId    : "",
    //the value to be added to the referrer URL when a person follows a link from this shared content on feed
    //可选,字符串
    ref       : "",
    //话题 the ShareHashtag for this content
    //可选,#号开头的字符串
    hashtag   : ""
}
*/

sharePhoto 照片

//已Facebook授权登录或安装了客户端APP才可分享
jsBridge.fbShare.sharePhoto({
  //可选的公共参数
  //...
  //照片数组
  photos: [
    {
      url    : "https://cdn.myapp.ltd/sys/1.jpg",
      caption: "图一的说明",
      //照片是用户还是应用生成的 whether the photo represented by this object was generated by the user or by the application
      //布尔类型
      userGenerated: false
    },
    {
      url    : "https://cdn.myapp.ltd/sys/2.jpg",
      caption: "图二的说明",
      userGenerated: false
    },
    {
      url    : "https://cdn.myapp.ltd/sys/3.jpg",
      caption: "图三的说明",
      userGenerated: false
    }
  ]
}, function(succ, data) {
  if (data.result == "success") {
    alert("成功:" + data.postId);
  } else if (data.result == "cancel") {
    alert("取消");
  } else if (data.result == "error") {
    alert("错误:" + data.message);
  } else {
    alert(JSON.stringify(data));
  }
});