anan66 commited on
Commit
1920ca0
·
1 Parent(s): f0ae3de

upload matchn game

Browse files
Files changed (1) hide show
  1. matchn/MatchNGame.html +18 -17
matchn/MatchNGame.html CHANGED
@@ -145,23 +145,24 @@
145
  </head>
146
  <body>
147
  <script>
148
- // 捕获安卓返回键
149
- document.addEventListener("backbutton", function () {
150
- if (confirm("确定要退出游戏吗?")) {
151
- // 关闭当前页面
152
- window.close();
153
- }
154
- }, false);
155
-
156
- // 捕获浏览器返回操作
157
- window.addEventListener("popstate", function (event) {
158
- if (confirm("确定要退出游戏吗?")) {
159
- window.history.go(-1); // 返回上一页
160
- } else {
161
- // 阻止返回操作
162
- window.history.pushState(null, null, window.location.href);
163
- }
164
- });
 
165
  </script>
166
  <canvas id='canvas'>
167
  HTML5 canvas appears to be unsupported in the current browser.<br />
 
145
  </head>
146
  <body>
147
  <script>
148
+ window.addEventListener('beforeunload', function(event){
149
+ var message = 'Are you sure you want to leave?';
150
+ event.returnValue = message;
151
+ return message;
152
+ })
153
+
154
+ <!-- g_blnCheckUnload = true; -->
155
+
156
+ <!-- window.onbeforeunload= function (e) { -->
157
+ <!-- e = e || window.event; -->
158
+ <!-- if (e) { -->
159
+ <!-- e.returnValue = '关闭提示'; -->
160
+ <!-- } -->
161
+
162
+ <!-- // Chrome, Safari, Firefox 4+, Opera 12+ , IE 9+ -->
163
+ <!-- return '关闭提示'; -->
164
+ <!-- }; -->
165
+
166
  </script>
167
  <canvas id='canvas'>
168
  HTML5 canvas appears to be unsupported in the current browser.<br />