---
title: "关于微信网页关闭问题"
author: "u010214413"
date: "2014-09-15T21:00:49Z"
tags: []
categories: ["移动开发"]
slug: "untitled"
draft: false
lastmod: "2014-09-15T21:00:49Z"
id: 2116769
url: "https://BertChen.iteye.com/blog/2116769"
---

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>