I'm trying to implement sharing to WeChat on our site.
Accordingly to docs, I have to load SDK from http://res.wx.qq.com/open/js/jweixin-1.0.0.js
, configure it, and call corresponding methods (onMenuShareAppMessage
in my case).
I did all configuration, it seems that it's ok (no errors displayed, wx.ready()
callback is executed), but when I call wx
methods, nothing happens at all.
Reading SDK code (minified), I can see that everything is wrapped in constructions like window.WeixinJSBridge ? WeixinJSBridge.doSmth() : doNothing()
. In my case WeixinJSBridge
is undefined.
But what is that WeixinJSBridge
and where should I get it? It's not described in docs. Googling it gives some pages on Chinese with same question – "WeixinJSBridge is undefined" and with no answer.
How to properly work with all this stuff? Or, maybe I'm totally misunderstand the docs and sharing to WeChat from website is impossible at all? Please somebody explain.
WeixinJSBridge
is an object available oncehttp://res.wx.qq.com/open/js/jweixin-1.0.0.js
is loaded inside the Wechat Web Browser.It's used specifically to start the payment process in Wechat App.
If you wanna test/debug it, download the wechat testing software for desktop here: https://mp.weixin.qq.com/wiki?action=doc&id=mp1455784140