diff --git a/module/VuFind/src/VuFind/Controller/AbstractRecord.php b/module/VuFind/src/VuFind/Controller/AbstractRecord.php
index 2b7c4de11a8b88bd05eb5e9928795c8f84505cda..d91a8eb3f7a0b44810e33d79883b2decb772dacc 100644
--- a/module/VuFind/src/VuFind/Controller/AbstractRecord.php
+++ b/module/VuFind/src/VuFind/Controller/AbstractRecord.php
@@ -537,7 +537,17 @@ class AbstractRecord extends AbstractBase
     {
         $details = $this->getRecordRouter()
             ->getTabRouteDetails($this->loadRecord(), $tab);
-        $target = $this->url()->fromRoute($details['route'], $details['params']);
+        $target = $this->getLightboxAwareUrl($details['route'], $details['params']);
+
+        // Special case: don't use anchors in jquerymobile theme, since they
+        // mess things up!
+        if (strlen($params) && substr($params, 0, 1) == '#') {
+            $themeInfo = $this->getServiceLocator()->get('VuFindTheme\ThemeInfo');
+            if ($themeInfo->getTheme() == 'jquerymobile') {
+                $params = '';
+            }
+        }
+
         return $this->redirect()->toUrl($target . $params);
     }