Reputation: 9804
I would like to know if it exists a way to detect the first launch of a browser instance in Javascript ?
In this case i would like to delete one of my session cookie.
Here is the problem :
In fact, i have build an application where the user can access only one time to my application in the same browser (tab or window). When the user is connected to my app, a session cookie is created. This cookie is deleted when the user close the browser or the tab. After that, if the user try to open 2 times my application in 2 differents tab for example, i am able to check if an instance of my app already running, and if it is the case i show a message to the user : "You are not granted to access 2 times the app in the same browser". When the user close the web page, i am able to delete the cookie. The problem is when the browser has crashed : My cookie stays and when the user restart the browser i prompt the message whereas there is no instance of my app already connected.
Regards
Upvotes: 0
Views: 495
Reputation: 1996
There are two kinds of cookies, session cookies and normal cookies.
You can create a normal cookie with expiration in hundret years. If the cookie is present, its not the first visit.
Upvotes: 1