0
You can create a variable in javascript or jquery and store cookies in it for a certain time X?
0
You can create a variable in javascript or jquery and store cookies in it for a certain time X?
Browser other questions tagged javascript jquery
You are not signed in. Login or sign up in order to post.
You are referring to the use of cookies?
– Máttheus Spoo
@Máttheusspoo I think that would be the right name
– Josimara
Can use localstorage, it depends a lot what you want to do..
– Fbor
You need to explain what you want best. In JS it is possible, in jQuery you cannot because it is not a programming language and has no variables. But there’s no point in keeping one cookie in a variable, especially if you want to cache. You can store a value in a cookie. If it’s anything more complex, then you need localstorage, but we don’t know what you need.
– Maniero
@Fbor I want to store ip + date to add it all up and create like an ID for x minutes and use in an api
– Josimara
@Maniero This is basically what you said I need to create a cookie stored for X time to use in some other functions.
– Josimara
Using cookie is sometimes bad because the customer can delete or block when they want.
– Sam
the user’s IP and date are already accessible on the server side, I do not see the need to store it in a Cookie. as for access control, you should not rely on data that can be edited on the client side, so I advise you to use jwt with Encryption, and store it on the localStorage. thus, sensitive user data could be part of the token.
– Tobias Mesquita
I recommend using another type of identification, this model is very flawed, but if you need to use it, you can save in Localstorage with your skills.
– Fbor