最近一个客户的需求找到我,他的网站是html静态页,想做微信jssdk分享,他不会实现,asp的他会,他的程序是asp的,让我帮忙写一段能在html静态页中实现jssdk微信分享,经过30分钟的努力,代码搞定,原理很简单,用js把标题,简介,图片传给jssdk.asp文件中,让他去执行,代码如下:
微信jssdk分享页
微信jssdk分享页接受页面
<%Dim timestamp,noncestr,jssdkurl,stringtosignjssdkurl=Request.ServerVariables("Http_Referer")timestamp = DateDiff("s","1970-01-01 08:00:00",Now)nonceStr = Wx.MakeRandStr(32)stringtosign = "jsapi_ticket="&Application("jsapi_ticket")(0)&"&noncestr="&nonceStr&"×tamp="×tamp&"&url="&jssdkurlsignature = Wx.SHA1(stringtosign,"Hex")share_title=request("title")share_desc=request("desc")share_img=request("img")%>