简体   繁体   English

在angularjs中注销后清除登录会话

[英]Clear login session after logging out in angularjs

I am trying to clear login session using AngularJS code. 我正在尝试使用AngularJS代码清除登录会话。

  $scope.clearLogin = function () {
        delete $window.sessionStorage;
        window.localStorage.clear();
        $window.location.href = 'index.html';
  }; 

This is redirecting me to index page but when I click on back button I am getting into the application and the session is still available. 这会将我重定向到索引页面,但是当我单击“后退”按钮时,我进入了应用程序,并且该会话仍然可用。

How to clear session restricting the user to log into the application after logging out? 注销后如何清除会话限制用户登录应用程序?

It should be $window 应该是$window

 $scope.clearLogin = function () {
        delete $window.sessionStorage;
        $window.localStorage.clear();
        $window.location.href = 'index.html';
  }; 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM