微信页面阻止android回退键退出

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<html>
<meta charset="utf-8" />
<meta name="viewport"
	content="initial-scale=1, maximum-scale=1, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />

<head>
<script src="//cdn.bootcss.com/jquery/3.0.0-alpha1/jquery.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"
	type="text/javascript"></script>

</head>
<script type="text/javascript">

$(function(){
	 $(window).bind('hashchange',
			 function(e) {
		 $('#urldisplay').html(window.location.hash);
		 window.history.forward(1)
		 //alert(2);
	 });
	 
	 var urlindex=1;
	$('#btn_hash').on('click',function(){
		window.location.hash ='#c_'+ (++urlindex);
	});	 
	 
	$('#btn').on('click',function(){
		alert(1);
		  WeixinJSBridge.invoke('closeWindow', {},
                  function(res) {})
	});
});
</script>
<body>asdasdasd

<input id="btn" type="button" value="aaaa"/> 

<input id="btn_hash" type="button" value="hash"/> 
<div id="urldisplay"></div>
</body>
</html>


你可能感兴趣的:(android,微信)