D
D
danyfir2016-06-15 14:53:33
PHP
danyfir, 2016-06-15 14:53:33

Is it possible to add styles to cookies?

Let's say there are two blocks
(style="display:none")Block 1
(style="display:block")Block 2
I want to make sure that styles are written to the cookie on click, but vice versa. That is, so that after clicking, the styles change:
(style="display:block")Block 1
(style="display:none")Block 2
Accordingly, after clearing the cookie, everything fell into place.
So, is it really possible to do this through cookies? Or, better through the session?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DTX, 2016-06-15
@DirecTwiX

> Is it possible to add styles to cookies?
Maybe why not. More precisely, add a sign that the button was pressed. And depending on it, hang styles.
> Or, it is better through session?
So session also uses cookies for storage of all parameters.

A
Archakov Dennis, 2016-06-15
@archakov06

Do it in LocalStorage. As for me, sessions and cookies are suitable for identification, rather than storing something left there. And LocalStorage is just right for this. Here the choice is yours. (For example, I store such data in LocalStorage)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question