| 
									
										
										
										
											2013-09-02 16:54:54 +08:00
										 |  |  | <html> | 
					
						
							|  |  |  | <body> | 
					
						
							|  |  |  | <script type="text/javascript" charset="utf-8"> | 
					
						
							| 
									
										
										
										
											2016-08-03 12:44:18 -07:00
										 |  |  |   // Only prevent unload on the first window close | 
					
						
							|  |  |  |   var unloadPrevented = false; | 
					
						
							| 
									
										
										
										
											2013-09-02 16:54:54 +08:00
										 |  |  |   window.onbeforeunload = function() { | 
					
						
							|  |  |  |     setTimeout(function() { | 
					
						
							| 
									
										
										
										
											2015-11-12 18:28:04 +08:00
										 |  |  |       require('electron').remote.getCurrentWindow().emit('onbeforeunload'); | 
					
						
							| 
									
										
										
										
											2013-09-02 16:54:54 +08:00
										 |  |  |     }, 0); | 
					
						
							| 
									
										
										
										
											2016-08-03 12:44:18 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if (!unloadPrevented) { | 
					
						
							|  |  |  |       unloadPrevented = true; | 
					
						
							|  |  |  |       return ''; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2013-09-02 16:54:54 +08:00
										 |  |  |   } | 
					
						
							|  |  |  |   window.close(); | 
					
						
							|  |  |  | </script> | 
					
						
							|  |  |  | </body> | 
					
						
							|  |  |  | </html> |