diff --git a/core/modules/toolbar/js/escapeAdmin.js b/core/modules/toolbar/js/escapeAdmin.js
index 0338280ef91169cd526812a997d5069ac5ab28b9..72a9fb8ecfcf2909aeea104ab2c35d186e3f3653 100644
--- a/core/modules/toolbar/js/escapeAdmin.js
+++ b/core/modules/toolbar/js/escapeAdmin.js
@@ -7,14 +7,15 @@
 
 "use strict";
 
+var pathInfo = drupalSettings.path;
 var escapeAdminPath = sessionStorage.getItem('escapeAdminPath');
 
 // Saves the last non-administrative page in the browser to be able to link back
 // to it when browsing administrative pages. If there is a destination parameter
 // there is not need to save the current path because the page is loaded within
 // an existing "workflow".
-if (!drupalSettings.currentPathIsAdmin && !/destination=/.test(window.location.search)) {
-  sessionStorage.setItem('escapeAdminPath', drupalSettings.currentPath);
+if (!pathInfo.currentPathIsAdmin && !/destination=/.test(window.location.search)) {
+  sessionStorage.setItem('escapeAdminPath', pathInfo.currentPath);
 }
 
 /**
@@ -27,7 +28,7 @@ Drupal.behaviors.escapeAdmin = {
   attach: function () {
     var $toolbarEscape = $('[data-toolbar-escape-admin]').once('escapeAdmin');
     if ($toolbarEscape.length) {
-      if (drupalSettings.currentPathIsAdmin && escapeAdminPath) {
+      if (pathInfo.currentPathIsAdmin && escapeAdminPath) {
         $toolbarEscape.attr('href', Drupal.url(escapeAdminPath));
         $toolbarEscape.closest('.toolbar-tab').removeClass('hidden');
       }