标签:dev gen win nod fun fine else bridge 分享功能
/* begin禁用微信分享功能 */ 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(); } /* end禁用微信分享功能 */ // 对浏览器的UserAgent进行正则匹配,不含有微信独有标识的则为其他浏览器 var useragent = navigator.userAgent; if (useragent.match(/MicroMessenger/i) != ‘MicroMessenger‘) { // 这里警告框会阻塞当前页面继续加载 // 以下代码是用javascript强行关闭当前页面 var opened = window.open(‘about:blank‘, ‘_self‘); /*opened.opener = null; opened.close();*/ }else{ window.alert = function(name){ var iframe = document.createElement("IFRAME"); iframe.style.display="none"; iframe.setAttribute("src", ‘data:text/plain,‘); document.documentElement.appendChild(iframe); window.frames[0].window.alert(name); iframe.parentNode.removeChild(iframe); } }
标签:dev gen win nod fun fine else bridge 分享功能
原文地址:https://www.cnblogs.com/xsl1995/p/9166465.html