Index: wp-admin/edit-form-advanced.php
===================================================================
--- wp-admin/edit-form-advanced.php	(revision 22724)
+++ wp-admin/edit-form-advanced.php	(working copy)
@@ -418,3 +418,21 @@
 try{document.post.title.focus();}catch(e){}
 </script>
 <?php endif; ?>
+
+<?php if ( 'attachment' == $post_type ) { ?>
+<script type="text/javascript">
+(function($){
+	function getFieldsContent() {
+		return ($('#title').val() || '') + ($('#attachment_caption').val() || '') +
+		($('#attachment_alt').val() || '') + ($('#attachment_content').val() || '') + ($('#post_name').val() || '');
+	}
+
+	var initial = getFieldsContent();
+
+	window.onbeforeunload = function() {
+		if ( initial != getFieldsContent() )
+			return '<?php _e('The changes you made will be lost if you navigate away from this page.'); ?>';
+	};
+})(jQuery);
+</script>
+<?php } ?>
Index: wp-admin/post-new.php
===================================================================
--- wp-admin/post-new.php	(revision 22724)
+++ wp-admin/post-new.php	(working copy)
@@ -43,7 +43,8 @@
 if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) )
 	wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' );
 
-wp_enqueue_script('autosave');
+if ( 'attachment' !== $post_type )
+	wp_enqueue_script('autosave');
 
 // Show post form.
 $post = get_default_post_to_edit( $post_type, true );
Index: wp-admin/post.php
===================================================================
--- wp-admin/post.php	(revision 22724)
+++ wp-admin/post.php	(working copy)
@@ -169,7 +169,9 @@
 		add_action('admin_notices', '_admin_notice_post_locked' );
 	} else {
 		$active_post_lock = wp_set_post_lock( $post->ID );
-		wp_enqueue_script('autosave');
+
+		if ( 'attachment' !== $post_type )
+			wp_enqueue_script('autosave');
 	}
 
 	$title = $post_type_object->labels->edit_item;
