diff --git a/inc/actions.php b/inc/actions.php
index 4083b0454d26f180ca57a77709d81656f0e9e9eb..e0ad908b74c39472ca274f3ec8f23f317fcae760 100644
--- a/inc/actions.php
+++ b/inc/actions.php
@@ -67,6 +67,22 @@ function act_dispatch(){
             act_sitemap($ACT);
         }
 
+        //recent changes
+        if ($ACT == 'recent'){
+            $show_changes = $INPUT->str('show_changes');
+            if (!empty($show_changes)) {
+                set_doku_pref('show_changes', $show_changes);
+            }
+        }
+
+        //diff
+        if ($ACT == 'diff'){
+            $difftype = $INPUT->str('difftype');
+            if (!empty($difftype)) {
+                set_doku_pref('difftype', $difftype);
+            }
+        }
+
         //register
         if($ACT == 'register' && $INPUT->post->bool('save') && register()){
             $ACT = 'login';
diff --git a/inc/common.php b/inc/common.php
index db39affc6a44b0ea22b34b96b1b3f7a7e91fa521..28b527633d1845ccab4547caac643a241758ed0d 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -1551,18 +1551,50 @@ function valid_input_set($param, $valid_values, $array, $exc = '') {
 
 /**
  * Read a preference from the DokuWiki cookie
+ * (remembering both keys & values are urlencoded)
  */
 function get_doku_pref($pref, $default) {
-    if(strpos($_COOKIE['DOKU_PREFS'], $pref) !== false) {
+    $enc_pref = urlencode($pref);
+    if(strpos($_COOKIE['DOKU_PREFS'], $enc_pref) !== false) {
         $parts = explode('#', $_COOKIE['DOKU_PREFS']);
         $cnt   = count($parts);
         for($i = 0; $i < $cnt; $i += 2) {
-            if($parts[$i] == $pref) {
-                return $parts[$i + 1];
+            if($parts[$i] == $enc_pref) {
+                return urldecode($parts[$i + 1]);
             }
         }
     }
     return $default;
 }
 
+/**
+ * Add a preference to the DokuWiki cookie
+ * (remembering $_COOKIE['DOKU_PREFS'] is urlencoded)
+ */
+function set_doku_pref($pref, $val) {
+    global $conf;
+    $orig = get_doku_pref($pref, false);
+    $cookieVal = '';
+
+    if($orig && ($orig != $val)) {
+        $parts = explode('#', $_COOKIE['DOKU_PREFS']);
+        $cnt   = count($parts);
+        // urlencode $pref for the comparison
+        $enc_pref = rawurlencode($pref);
+        for($i = 0; $i < $cnt; $i += 2) {
+            if($parts[$i] == $enc_pref) {
+                $parts[$i + 1] = rawurlencode($val);
+                break;
+            }
+        }
+        $cookieVal = implode('#', $parts);
+    } else if (!$orig) {
+        $cookieVal = ($_COOKIE['DOKU_PREFS'] ? $_COOKIE['DOKU_PREFS'].'#' : '').rawurlencode($pref).'#'.rawurlencode($val);
+    }
+
+    if (!empty($cookieVal)) {
+        setcookie('DOKU_PREFS', $cookieVal, time()+365*24*3600, DOKU_BASE, '', ($conf['securecookie'] && is_ssl()));
+    }
+}
+
 //Setup VIM: ex: et ts=2 :
diff --git a/inc/html.php b/inc/html.php
index c8b96cbc0d2d69f22522447f9347b7e0a20669be..a48f18bff89a17dff863ceb9f2d9efd649798a9e 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -1088,8 +1088,17 @@ function html_diff($text='',$intro=true,$type=null){
     global $REV;
     global $lang;
     global $INPUT;
+    global $INFO;
 
-    if(!$type) $type = $INPUT->str('difftype');
+    if(!$type) {
+        $type = $INPUT->str('difftype');
+        if (empty($type)) {
+            $type = get_doku_pref('difftype', $type);
+            if (empty($type) && $INFO['ismobile']) {
+                $type = 'inline';
+            }
+        }
+    }
     if($type != 'inline') $type = 'sidebyside';
 
     // we're trying to be clever here, revisions to compare can be either
diff --git a/inc/template.php b/inc/template.php
index 2c083c964df0faca7b70df9b4852dbcc3f170794..a5bcabf1ec8975873d12c0925e0adbe0b9fb6595 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -124,7 +124,11 @@ function tpl_content_core() {
             html_diff();
             break;
         case 'recent':
-            html_recent($INPUT->extract('first')->int('first'), $INPUT->str('show_changes'));
+            $show_changes = $INPUT->str('show_changes');
+            if (empty($show_changes)) {
+                $show_changes = get_doku_pref('show_changes', $show_changes);
+            }
+            html_recent($INPUT->extract('first')->int('first'), $show_changes);
             break;
         case 'index':
             html_index($IDX); #FIXME can this be pulled from globals? is it sanitized correctly?