diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php
index 64899304d78c07687cca7c0bfef2ab1d47a039a2..5697430051fcbe21ad28b7ca015c036aacf1183e 100644
--- a/core/Controller/LoginController.php
+++ b/core/Controller/LoginController.php
@@ -130,7 +130,10 @@ class LoginController extends Controller {
 		}
 		$this->userSession->logout();
 
-		$response = new RedirectResponse($this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm'));
+		$response = new RedirectResponse($this->urlGenerator->linkToRouteAbsolute(
+			'core.login.showLoginForm',
+			['clear' => true] // this param the the code in login.js may be removed when the "Clear-Site-Data" is working in the browsers
+		));
 		$response->addHeader('Clear-Site-Data', '"cache", "storage", "executionContexts"');
 		return $response;
 	}
diff --git a/core/js/login.js b/core/js/login.js
index 64be29bfec62163cf54662d8522e5be3ba74767c..8ef76c5717b749a856df9cc9fd27f6fe6e8bd3eb 100644
--- a/core/js/login.js
+++ b/core/js/login.js
@@ -41,4 +41,10 @@ $(document).ready(function() {
 	$('form[name=login]').submit(OC.Login.onLogin);
 
 	$('#remember_login').click(OC.Login.rememberLogin);
+
+	var clearParamRegex = new RegExp('clear=1');
+	if (clearParamRegex.test(window.location.href)) {
+		window.localStorage.clear();
+		window.sessionStorage.clear();
+	}
 });