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 : ""
}
*/
A标签执行JS示例代码
<a href="javascript:void(0)" onclick="zhixing()">执行</a>
<!-- 写入一个A标签href值为"javascript:void(0)",定义点击事件onclick;-->
<script src="您的服务器URL/jsbridge-mini.js"></script>
<!-- 在您的服务器引入一门JS地址,请下载jsbridge-mini.js上传您自己的服务器获取链接;-->
<script type="text/javascript">
function zhixing() {
<!--这里可以直接复制JS核心代码到此{}括号内-->
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 : ""
}
*/
}
</script>
<!--执行核心代码;
//如果需要进入页面就执行,去掉点击事件即可;-->
按钮执行JS示例代码
<button onclick="zhixing()" >执行</button>
<!-- //写一个按钮,定义点击执行事件; -->
<script src="您的服务器URL/jsbridge-mini.js"></script>
<!-- //在您的服务器引入一门JS地址,请下载jsbridge-mini.js上传您自己的服务器获取链接; -->
<script type="text/javascript">
function zhixing() {
<!--这里可以直接复制JS核心代码到此{}括号内-->
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 : ""
}
*/
}
</script>
<!-- //执行核心代码;
//如果需要进入页面就执行,去掉点击事件即可; -->