The problem of multi-page login with a single account

premise: I have a management system, the system has a project system, a user can have multiple projects, after logging in, you can switch projects. The front end will save the project that the user is currently logged in to with localStorage, so that after refreshing, it can still remain in the previous project

.

question: now there is a user of two AMagi B projects who use two tab pages in the browser. If you first switch to An on the first tab page, then localStorage records A, and then An in the second tab page is switched to BQuery localStorage. Then A will be overwritten, and then go back to the first tab page to refresh, and the project will become the same as the second tab page

.
Dec.22,2021

share data among multiple tab pages in the browser, which can be achieved through cookie or localStorage. In some cases, the data needs to be cleared after the browser is closed, which can be done through sessionStorage. However, sessionStorage is only saved in the current tab page, and if you want to share this data among multiple tab, you can do so through localStorage.

I don't know if it will be of any help to you ~

if you can't achieve the effect you want, then I feel that you can probably only start with url to distinguish between projects.

Menu