Index: wp-admin/js/common.js
===================================================================
--- wp-admin/js/common.js	(revision 23381)
+++ wp-admin/js/common.js	(working copy)
@@ -425,3 +425,292 @@
 });
 
 })(jQuery);
+
+jQuery(document).ready( function($){
+
+    autosave_local_storage.remove_stale_data();
+
+    autosave_local_storage.display_data();
+
+});
+
+autosave_local_storage = {
+
+    lastsaveddata:'',
+    modified_data : {},
+    html:'',
+    content : new Array(),
+
+    /**
+     * Prepares data for saving in local storage.
+     * @return {Object}
+     */
+    prepare_data: function() {
+
+        var post_data = {
+            action: "autosave",
+            post_ID:  jQuery("#post_ID").val() || 0,
+            post_type: jQuery('#post_type').val() || ""
+        };
+
+        if ( fullscreen && fullscreen.settings.visible ) {
+            post_data["post_title"] = jQuery('#wp-fullscreen-title').val() || '';
+            post_data["content"] = jQuery("#wp_mce_fullscreen").val() || '';
+        } else {
+            post_data["post_title"] = jQuery("#title").val() || '';
+            post_data["content"] = jQuery("#content").val() || '';
+        }
+
+        if ( jQuery('#post_name').val() )
+            post_data["post_name"] = jQuery('#post_name').val();
+
+        var cats = ([]);
+
+        jQuery("[name='post_category[]']:checked").each( function(i) {
+            cats.push(this.value);
+        } );
+        post_data["catslist"] = cats.join(",");
+
+        if ( jQuery("#comment_status").prop("checked") )
+            post_data["comment_status"] = 'open';
+        if ( jQuery("#ping_status").prop("checked") )
+            post_data["ping_status"] = 'open';
+        if ( jQuery("#excerpt").size() )
+            post_data["excerpt"] = jQuery("#excerpt").val();
+        if ( jQuery("#post_author").size() )
+            post_data["post_author"] = jQuery("#post_author").val();
+        if ( jQuery("#parent_id").val() )
+            post_data["parent_id"] = jQuery("#parent_id").val();
+        post_data["user_ID"] = jQuery("#user-id").val();
+        if ( jQuery('#auto_draft').val() == '1' )
+            post_data["auto_draft"] = '1';
+
+        post_data["save_time"] = new Date().getTime();
+
+        post_data['storage_status'] = 'fresh';
+
+        return post_data;
+
+    },
+
+    /**
+     * Returns post id from post edit page
+     * @return {*|int}
+     */
+    get_post_id: function() {
+        var post_id = jQuery("#post_ID").val() || 0;
+
+        if( 0 < post_id ) {
+            return post_id;
+        }
+    },
+
+    /**
+     * Checks if local storage is enabled or not
+     * @return {*}
+     */
+    get_storage: function() {
+
+        if ( window.localStorage ) {
+            //have local storage container per blogid
+            var store = localStorage.getItem( 'wp_autosave_'+commonL10n.blog_id );
+
+            if( store ) {
+                return JSON.parse( store );
+            } else {
+                return {};
+            }
+        }
+    },
+
+    set_storage: function( storage_arr ) {
+        if ( window.localStorage ) {
+            localStorage.setItem( 'wp_autosave_'+commonL10n.blog_id, storage_arr );
+        }
+    },
+
+    /**
+     * Misc utility function to save/delete/edit post data in local storage.
+     * @param data
+     * @return {*}
+     */
+    handle_post_data: function( data ) {
+
+        var storage_arr = this.get_storage();
+
+        if ( storage_arr ) {
+
+            var post_id = this.get_post_id();
+
+            if( post_id ) {
+
+                if( data ) {
+
+                    //we wanna get rid of particular revision if data ='del'
+                    if( 'del' === data){
+
+                        if( typeof storage_arr[post_id] !== 'undefined' ) {
+                            delete storage_arr[post_id];
+                        }
+
+                    } else{
+                        storage_arr[post_id] = data;
+                    }
+
+                    storage_arr = JSON.stringify( storage_arr );
+
+                    this.set_storage( storage_arr );
+                //else return data for particular post
+                } else if( typeof storage_arr[post_id] !== 'undefined' ) {
+
+                     return storage_arr[post_id];
+                }
+            }
+
+        }
+    },
+
+    /**
+     * Set post data for particular post id
+     */
+    set_data: function() {
+
+        var post_data = this.prepare_data();
+
+        var storage_data = this.handle_post_data();
+
+        //if the content and title did not change from last server save,dont keep data in local storage
+        if ( ( post_data["post_title"].length == 0 && post_data["content"].length == 0 )
+            || post_data["post_title"] + post_data["content"] == autosaveLast
+            || post_data["post_title"] + post_data["content"] == this.lastsaveddata
+            ) {
+            //Save only 5 revisions if there are more remove
+            if( storage_data && 5 < storage_data.length  ) {
+                storage_data.pop();
+                this.handle_post_data( storage_data )
+            }
+
+        } else {
+
+            if( storage_data  ) {
+
+                //Save only 5 revisions if there are more remove
+                if( 5 < storage_data.unshift( post_data ) ) {
+                    storage_data.pop();
+                }
+
+            } else {
+                //post data was not available create data for our new post id
+                var storage_data = new Array( post_data );
+            }
+
+            //Make sre we know whats our last saved data, so we dont keep on saving same data and replace important info
+            this.lastsaveddata = post_data["post_title"] + post_data["content"];
+
+            this.handle_post_data( storage_data );
+
+        }
+    },
+
+    /**
+     * Remove all data from local storage if its saved for more that 12 hours.
+     */
+    remove_stale_data: function() { 
+
+        var stored_data = this.get_storage(); 
+
+        if( stored_data ) { 
+
+            jQuery.each( stored_data, function( key, value ) { 
+
+                var current_time = new Date().getTime();
+
+                var new_val_arr = new Array();
+
+                for( var i=0; i < value.length; i++ ) {
+
+                    var post_store = value[i];
+
+                    var time_diff = current_time - post_store['save_time'];
+
+                    //check for 12 hr difference
+                    if( 43200000 > time_diff  ) {
+                        new_val_arr.unshift( post_store );
+                    }
+                }
+                if( new_val_arr && 0 < new_val_arr.length ) {
+                    autosave_local_storage.modified_data[key] = new_val_arr;
+                }
+            });
+
+            storage_arr = JSON.stringify( this.modified_data );
+
+            this.modified_data = '';
+
+            this.set_storage( storage_arr );
+        }
+    },
+
+    /**
+     * Escape html so we can show in div
+     * @param content
+     * @return {*}
+     */
+    esc_html: function( content ) {
+
+            content = jQuery("<div/>").text(content).html();
+
+
+            return content;
+
+    },
+
+    /**
+     * Show data in admin menu that one has historical saved data available for recovery in case one wants.
+     */
+    display_data: function() {
+
+        stored_data = this.get_storage();
+
+        if( stored_data ) {
+
+            jQuery.each( stored_data, function( key, post_data ) {
+
+                for( var i= post_data.length-1; i > -1; i-- ) {
+
+                    var title = autosave_local_storage.esc_html(post_data[i]["post_title"]);
+
+                    if( jQuery.trim(title) == '' ) {
+                        title = post_data[i]["post_ID"];
+                    }
+
+
+                    autosave_local_storage.content[key+i] = autosave_local_storage.esc_html(post_data[i]["content"]);
+
+
+                   autosave_local_storage.html = autosave_local_storage.html + '<span style="padding: 0 10px;"><a class="autosave-recover" data-key="'+key+i+'" data-postid="'+key+'" data-title="'+title+'" href="javascript:void(0)">'+title+'</a> </span>'
+
+                }
+
+            });
+
+            if( this.html != '' ) {
+
+                var notice = "<div class='error' id='autosave_local_storage_wrap'><p><strong>Post History</strong> <a href='javascript:void(0)' id='autosave_local_storage_hide'>Hide This Box</a></p></p><p>"+this.html+"<div style='padding: 0 10px;' id='autosave_local_storage' ></div></p></div>";
+
+                jQuery("#wpbody .wrap h2:first").after( notice );
+
+                jQuery("#autosave_local_storage_hide").on("click", function(event){
+
+                    jQuery("#autosave_local_storage_wrap").hide();
+                });
+
+                jQuery(".autosave-recover").on("click", function(event){
+                    jQuery('#autosave_local_storage').html( autosave_local_storage.content[jQuery(this).data('key')] );
+                });
+            }
+
+        }
+
+    }
+}
Index: wp-includes/js/autosave.js
===================================================================
--- wp-includes/js/autosave.js	(revision 23381)
+++ wp-includes/js/autosave.js	(working copy)
@@ -5,10 +5,13 @@
 	autosaveLast = ( $('#post #title').val() || '' ) + ( $('#post #content').val() || '' );
 	autosavePeriodical = $.schedule({time: autosaveL10n.autosaveInterval * 1000, func: function() { autosave(); }, repeat: true, protect: true});
 
+    autosavePeriodical_client = $.schedule({time: 10000, func: function() { autosave_local_storage.set_data(); }, repeat: true, protect: true});
+
 	//Disable autosave after the form has been submitted
 	$("#post").submit(function() {
 		$.cancel(autosavePeriodical);
-		autosaveLockRelease = false;
+        $.cancel(autosavePeriodical_client);
+        autosaveLockRelease = false;
 	});
 
 	$('input[type="submit"], a.submitdelete', '#submitpost').click(function(){
@@ -341,6 +344,9 @@
 	}
 
 	autosaveOldMessage = jQuery('#autosave').html();
+
+    autosave_local_storage.set_data();
+
 	jQuery.ajax({
 		data: post_data,
 		beforeSend: doAutoSave ? autosave_loading : null,
Index: wp-includes/script-loader.php
===================================================================
--- wp-includes/script-loader.php	(revision 23381)
+++ wp-includes/script-loader.php	(working copy)
@@ -68,7 +68,8 @@
 
 	$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), false, 1 );
 	did_action( 'init' ) && $scripts->localize( 'common', 'commonL10n', array(
-		'warnDelete' => __("You are about to permanently delete the selected items.\n  'Cancel' to stop, 'OK' to delete.")
+		'warnDelete' => __("You are about to permanently delete the selected items.\n  'Cancel' to stop, 'OK' to delete."),
+		'blog_id' => get_current_blog_id()
 	) );
 
 	$scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", array(), '1.6.1', 1 );
