42 Star 133 Fork 47

JefferyWang / nativeShare.js

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

nativeShare

nativeShare是一个可以通过javascript直接调用原生分享的工具. demo

我们知道现在我们无法直接通过js直接跳转到微信和QQ等软件进行分享,但是现在像UC浏览器和QQ浏览器这样的主流浏览器自带一个分享工具,而他们也有自己定义的js接口.我们通过调用浏览器的接口去调用浏览器的分享,从而实现原生分享功能.是不是很酷呢?

该工具具有以下特点:

  • 支持原生微博、微信好友、微信朋友圈、QQ好友、QQ空间分享

  • 支持调用浏览器更多分享功能

  • 注意:目前仅支持手机UC浏览器和QQ浏览器

github项目地址: https://github.com/JefferyWang/nativeShare.js

Git@OSC项目地址: http://git.oschina.net/wangjunfeng/nativeShare.js

扫描二维码访问Demo

Demo

使用方法

  • 引入CSS文件
<link rel="stylesheet" href="nativeShare.css"/>
  • 在需要放分享的地方插入以下代码
<div id="nativeShare"></div>
  • 添加配置,并实例化
<script>
    var config = {
        url:'http://blog.wangjunfeng.com',// 分享的网页链接
        title:'王俊锋的个人博客',// 标题
        desc:'王俊锋的个人博客',// 描述
        img:'http://www.wangjunfeng.com/img/face.jpg',// 图片
        img_title:'王俊锋的个人博客',// 图片标题
        from:'王俊锋的博客' // 来源
    };
    var share_obj = new nativeShare('nativeShare',config);
</script>

截图

分享列表 微博分享 朋友圈分享 微信好友分享 QQ好友分享 QQ空间分享 更多

The MIT License (MIT) Copyright (c) 2015 王俊锋 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

一个在手机网页端可以直接调用原生分享的js 展开 收起
JavaScript
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/techlivewang/nativeShare.js.git
git@gitee.com:techlivewang/nativeShare.js.git
techlivewang
nativeShare.js
nativeShare.js
master

搜索帮助