一、页面加载禁用用户的分享菜单
function onBridgeReady() { WeixinJSBridge.call('hideOptionMenu'); } if (typeof WeixinJSBridge == "undefined") { if (document.addEventListener) { document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false); } else if (document.attachEvent) { document.attachEvent('WeixinJSBridgeReady', onBridgeReady); document.attachEvent('onWeixinJSBridgeReady', onBridgeReady); } } else { onBridgeReady(); }
二、ios不兼容,ios可能会把所有的页面都禁用,在需要显示分享菜单的页面加上以下代码
document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() { WeixinJSBridge.call('showOptionMenu');//显示右上角菜单 });
以下代码有问题,不用看
<script src="./jweixin.js" type="text/javascript" charset="utf-8">script> <script type="text/javascript" charset="utf-8"> wx.config({ "debug":false, "beta":false, "jsApiList":["openEnterpriseChat","openChatWithMsg","selectExternalContact","openUserProfile","thirdPartyOpenPage","getCurExternalContact","onMenuShareTimeline","onMenuShareAppMessage","hideOptionMenu","hideMenuItems"], "appId":"xxx", "nonceStr":"xxxx", "timestamp":xxxx, "url":"xxxx", "signature":"xxxx" }); wx.ready(function() { wx.hideOptionMenu(); wx.hideMenuItems(); }); script>