out.print("<script>document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {WeixinJSBridge.invoke('closeWindow',{},function(res){});}, false);</script>");
out.print("<script>document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {WeixinJSBridge.call('closeWindow');});</script>");
这两种方式都可以用,核心点在于'WeixinJSBridgeReady'当微信浏览器加载网页后会自动执行onBridgeReady方法。我这里是在Action中跳转到前台这样写的。大家在网页中可以之间在JS中加入
<script>
document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {WeixinJSBridge.call('closeWindow');});
</script>
out.print("<script>document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {WeixinJSBridge.call('closeWindow');});</script>");
这两种方式都可以用,核心点在于'WeixinJSBridgeReady'当微信浏览器加载网页后会自动执行onBridgeReady方法。我这里是在Action中跳转到前台这样写的。大家在网页中可以之间在JS中加入
<script>
document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {WeixinJSBridge.call('closeWindow');});
</script>