Index: modules/node/node.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v retrieving revision 1.29 diff -u -r1.29 node.pages.inc --- modules/node/node.pages.inc 17 Feb 2008 19:29:07 -0000 1.29 +++ modules/node/node.pages.inc 26 Mar 2008 22:10:45 -0000 @@ -399,6 +399,7 @@ $output = theme('node_preview', $cloned_node); } drupal_set_title(t('Preview')); + drupal_add_js(drupal_get_path('module', 'node') .'/node.js'); return $output; } Index: modules/node/node.js =================================================================== RCS file: modules/node/node.js diff -N modules/node/node.js --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/node/node.js 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,14 @@ +// $id$ + +/** + * Make sure that users don't go to a different page and unintentionally + * lose their content. + */ +Drupal.behaviors.nodePreviewProtect = function(context) { + $("div.preview a", context).click(function() { + if (!confirm(Drupal.t("Are you sure you want to navigate away from this page?"))) { + // Do not navigate away from the page. + return false; + } + }); +}