zoukankan      html  css  js  c++  java
  • 网页中如何进行网页内容分享到微博上

    有时候我们需要把网页的内容分享到微博上,类似于网易新闻的内容分享,看了微博的开发文档,不是特别明白,后来根据资料,找到了另外一种实现的方法。以后有空的时候研究下微博的分享开发文档再次重新实现这个功能

    *微博分享*/
    function shareweibo() {
        window.sharetitle = $(".print-tit").html();//分享的标题
        window.shareUrl = $(".print-info img").eq(0).attr('src');//分享显示的图片(默认第一张图片)
        share();
    }
    
    function share() {
        (function(s, d, e) {
            try {} catch (e) {}
            var f = 'http://v.t.sina.com.cn/share/share.php?',
                u = window.location.href,
                p = ['url=', e(u), '&title=', e(window.sharetitle), '&appkey=1389975891', '&pic=', e(window.shareUrl)].join('');
    
            function a() {
                if (!window.open([f, p].join(''), 'mb', ['toolbar=0,status=0,resizable=1,width=620,height=450,left=', (s.width - 620) / 2, ',top=', (s.height - 450) / 2].join(''))) u.href = [f, p].join('');
            };
            if (/Firefox/.test(navigator.userAgent)) { setTimeout(a, 0) } else { a() }
        })(screen, document, encodeURIComponent);
    }
    

      

  • 相关阅读:
    Js 30 BOM
    js面向对象
    js模态窗口
    js默认行为(也称默认事件)
    框架的控件隐藏
    20150706 js之定时器
    sublime快捷方式和node.js
    js回调函数2
    Hibernate 多对一
    Hibernate入门之配置文件
  • 原文地址:https://www.cnblogs.com/yesu/p/7644794.html
Copyright © 2011-2022 走看看