diff --git includes/authorize.inc includes/authorize.inc
index c5ba691..9a51abb 100644
--- includes/authorize.inc
+++ includes/authorize.inc
@@ -95,7 +95,7 @@ function authorize_filetransfer_form($form_state) {
 
       // If the user switches from JS to non-JS, Drupal (and Batch API) will
       // barf. This is a known bug: http://drupal.org/node/229825.
-      setcookie('has_js', '', time() - 3600, '/');
+      setcookie('has_js', '', REQUEST_TIME - 3600, '/');
       unset($_COOKIE['has_js']);
 
       // Change the submit button to the submit_process one.
diff --git includes/common.inc includes/common.inc
index 4426205..ed62c04 100644
--- includes/common.inc
+++ includes/common.inc
@@ -4043,7 +4043,10 @@ function drupal_get_js($scope = 'header', $javascript = NULL, $skip_alter = FALS
   $setting['ajaxPageState']['js'] = array_fill_keys(array_keys($items), 1);
   unset($setting['ajaxPageState']['js']['settings']);
   drupal_add_js($setting, 'setting');
-
+  // Check to see whether we need to set all cokkies to be session-only.
+  if (variable_get('drupal_cookies_session_only', FALSE)) {
+    $setting['cookie']['sessiononly'] = 1;
+  }
   // If we're outputting the header scope, then this might be the final time
   // that drupal_get_js() is running, so add the setting to this output as well
   // as to the drupal_add_js() cache. If $items['settings'] doesn't exist, it's
diff --git includes/session.inc includes/session.inc
index d86d72e..bebf8c8 100644
--- includes/session.inc
+++ includes/session.inc
@@ -339,6 +339,9 @@ function drupal_session_regenerate() {
     }
     $params = session_get_cookie_params();
     $session_id = drupal_hash_base64(uniqid(mt_rand(), TRUE) . drupal_random_bytes(55));
+    if (variable_get('drupal_cookies_session_only', FALSE)) {
+      $params['lifetime'] = 0;
+    }
     // If a session cookie lifetime is set, the session will expire
     // $params['lifetime'] seconds from the current request. If it is not set,
     // it will expire when the browser is closed.
diff --git misc/tabledrag.js misc/tabledrag.js
index ccb9f34..f7f3d72 100644
--- misc/tabledrag.js
+++ misc/tabledrag.js
@@ -166,10 +166,11 @@ Drupal.tableDrag.prototype.initColumns = function () {
   // Now hide cells and reduce colspans unless cookie indicates previous choice.
   // Set a cookie if it is not already present.
   if ($.cookie('Drupal.tableDrag.showWeight') === null) {
+    // The cookie expires in one year.
+    var expires = (Drupal.settings.cookie.sessiononly != null) 0 : 365;
     $.cookie('Drupal.tableDrag.showWeight', 0, {
       path: Drupal.settings.basePath,
-      // The cookie expires in one year.
-      expires: 365
+      expires: expires
     });
     this.hideColumns();
   }
diff --git modules/toolbar/toolbar.js modules/toolbar/toolbar.js
index fb1788c..c31ff4f 100644
--- modules/toolbar/toolbar.js
+++ modules/toolbar/toolbar.js
@@ -49,13 +49,15 @@ Drupal.toolbar.collapse = function() {
     .attr('title',  toggle_text)
     .html(toggle_text);
   $('body').removeClass('toolbar-drawer').css('paddingTop', Drupal.toolbar.height());
+  // The cookie should "never" expire unless we have set all session cookies.
+  var expires = (Drupal.settings.cookie.sessiononly != null) 0 : 365000;
   $.cookie(
     'Drupal.toolbar.collapsed',
     1,
     {
       path: Drupal.settings.basePath,
-      // The cookie should "never" expire.
-      expires: 36500
+
+      expires: lifetime
     }
   );
 };
diff --git modules/user/user.module modules/user/user.module
index 2c1c6b2..94dc73e 100644
--- modules/user/user.module
+++ modules/user/user.module
@@ -3665,9 +3665,10 @@ function user_login_destination() {
  *   An array of key/value pairs to be saved into a cookie.
  */
 function user_cookie_save(array $values) {
+  // Set cookie for 365 days unless we are only setting session cookies.
+  $expires = variable_get('drupal_cookies_session_only', FALSE) ? 0 : REQUEST_TIME + 31536000;
   foreach ($values as $field => $value) {
-    // Set cookie for 365 days.
-    setrawcookie('Drupal.visitor.' . $field, rawurlencode($value), REQUEST_TIME + 31536000, '/');
+    setrawcookie('Drupal.visitor.' . $field, rawurlencode($value), $expires, '/');
   }
 }
 
