在微信浏览器中执行js: typeof(WeixinJSBridge) 为什么是undefined呢 页面需要引入什么js么?
不需要引用js,但是你要这么写:
if (typeof WeixinJSBridge == "undefined") {
if (document.addEventListener) {
document.addEventListener('WeixinJSBridgeReady', wxPayCall, false);
} else if (document.attachEvent) {
document.attachEvent('WeixinJSBridgeReady', wxPayCall);
document.attachEvent('onWeixinJSBridgeReady', wxPayCall);
}
}
你要在注册一下WeixinJSBridgeReady这个事件
不需要引用js,但是你要这么写:
if (typeof WeixinJSBridge == "undefined") {
if (document.addEventListener) {
document.addEventListener('WeixinJSBridgeReady', wxPayCall, false);
} else if (document.attachEvent) {
document.attachEvent('WeixinJSBridgeReady', wxPayCall);
document.attachEvent('onWeixinJSBridgeReady', wxPayCall);
你要在注册一下WeixinJSBridgeReady
不需要引入js
现在已经被禁用了
function weixinShareTimeline(title,desc,link,imgUrl)
WeixinJSBridge.invoke('shareTimeline',
"img_url":imgUrl,
//"img_width":"640",
//"img_height":"640",
"link":link,
"desc": desc,
"title":title