Presist data in incognito mode - javascript

I am facing an issue while working with two different sessions in my application. The first session is an admin dashboard and the second session is the client-side, which is in incognito mode. The incognito mode session works well until I refresh the page, and all data is lost. I am using redux-persist and redux-persist-storage for data persistence. However, it should be noted that both sessions have different data.
Can someone suggest a solution to this issue and help me persist the data even after refreshing the incognito session?

Related

Detect clearing browser cookies in MVC 5

I have searched this for long time, unfortunately I couldn't find a helpful answer. when a user accessing my asp.net mvc 5 application and do a clear cookies from his browser, how can I detect that the cookies has been flushed and sign out the user without refreshing the page?
I have noticed this feature in Gmail. it automatically detects cookies flushing and redirect you to the login page.
Any thoughts?
Almost every login pipeline use cookie.
Usually you store some sort of userHash or even loginToken in cookies on login action.
So you don't detect that cookies flushed. You just check cookie exists on every request and if not - you redirect user.

Where to store user data in SPA

I have been developing a SPA with AngularJS and I have stored the user data in an Angular Value service but I do not feel confortable with that, basically because the Angular Value is not shared between browser tabs. So if the user opens a new browser tab and on every page refresh (F5) I have to request the server the user data like full name, email, etc. I am using a REST API.
Is this approach fine or not?. If I use localStorage it will help me to share data between tabs but I do not know if it is a better technique.
There are only 3 places you could store your data in a browser
Cookie
Local storage
Database (IndexedDB or Web SQL)
You can open your console panel to see these option.
Consideration:
Security
It depends on how important or sensitive your data stored in the
browser, if it is user sensitive, you should never stored them in the browser in the 1st place!
Size
how big is the data, you going to store? if it is huge it is good to store them in the Database, you could check out some of this framework (PouchDB)
if it is small, you could just store them in the local storage

Multiple Refresh Requests Yields Self-Removing LocalStorage Items in Javascript

Today, I came up with an issue which yields localstorage to crash.
I have username and password credentials stored in localstorage. When user refreshes the page, system programatically logins by using these credentials stored in localstorage.
But when user spams refresh button for 4 or 5 times(without letting page to be loaded), localstorage remove credentials.
To solve this problem, I've added breakpoints in every localstorage.removeItem to see if I delete this credentials by mistake, but non of them executed.
So my question is, is there any other way to remove localstorage's credentials or am I facing with some kind of bug?
I'm using Google Chrome v35.0.1916.153.
Thanks.

Reload Scenario in AngularJS

I am currently working on a mobile app..where I am fetching a response from a REST GET call.
Every thing is perfect. But , I want expert suggestion on how to re-render this data if user reloads the page.. or what is the best way to handle this scenario. Caching / storage won't help me here as this is sensitive data.
Need expert opinion please?
Maybe you should consider session storage. It will persist only as long as the current session is active (until tab or window is closed), and you can certainly think of additional security strategies, such as encryption and expiration.
Build an AngularJS service for your data source which will first query the session storage as a cache, before bothering your servers. I'd recommend creating a service that wraps session storage itself - maybe call it a ThingCache - that would be injected into the main data service.

How does websites store persistent/temporary states w/o cookies or local storage or database storage?

I'm not sure how a certain website is storing its state. I have disabled setting cookies from that website( running in Chrome ). I have deleted all local and database storage from that site, but for some reason, that site can still detect somehow that its the same computer as before. How does it do that?
See evercookie for a few possibilities.

Categories

Resources