实现想法:
将按钮添加到html中,然后单击按钮以触发JS函数
2 .将window.location.href属性添加到js函数
在window.location.href中编辑要传输的地址和title等信息
HTML代码如下所示。
button class=' BTN BTN-default 'nclick=' forward video ('要立即传输/buttonJS代码,请执行以下操作:
pre name=' code ' class=' JavaScript ' script type=' text/JavaScript ' functionforwardvideo ({ URL=' www.mi glass } ) window.location.href=' http://service.Weibo.com/share/share.PHP? title=' encodeuri component (document.title ) (URL='encodeuricomponent ) URL ) ) pic='encodeuricomponent ) imgpath (/
注意事项:
1 .新浪微博图片参数为pic
2 .图像路径是部署在服务器上的路径