onbeforeunload in Chrome using jQuery
===

I use this code to check  the user if they're sure they want to leave the page. In firefox, it is ok but in chrome I see the message 'Warning!Do you want to exit?' two times???
Somebody can help me?Thanks

 

   

    <script type="text/javascript">
	var formModify = false;
	var exit= false;
	jQuery(function() {

		
		$(' form select, form textarea').focus(function() {
			if($(this).attr('id') != 'input_request'){
				exit= true;
			}else{
				exit= false;
			}
		});

		
		
	});

	window.onbeforeunload = function() {
		if (exit) {
			return 'Warning!' + '\n' + 'Do you want to exit?';
			
		}else{
			
		}
	};

	
</script>