String userAgent = request.getHeader("user-agent").toLowerCase();
PrintWriter writer = response.getWriter();
StringBuilder sb = new StringBuilder();
//微信客户端
if(userAgent.indexOf("micromessenger") != -1){
sb.append("");
sb.append("");
sb.append("");
sb.append("
sb.append("if(typeof window.WeixinJSBridge=='undefined'){$(document).on('WeixinJSBridgeReady',function(){WeixinJSBridge.call('closeWindow')})}");
sb.append("");
sb.append("");
}
//支付宝
else if(userAgent.indexOf("alipay") != -1){
sb.append("");
sb.append("");
sb.append("");
sb.append("
sb.append("if(typeof window.AlipayJSBridge=='undefined'){$(document).on('AlipayJSBridgeReady',function(){AlipayJSBridge.call('closeWebview')})}");
sb.append("");
sb.append("");
}
writer.write(sb.toString());