As far as I know, it is not possible to maintain the state of the DOM even after page load, is there any technique or some way out to keep the function in cookie or storage (local, session) to later give eval ()?
As far as I know, it is not possible to maintain the state of the DOM even after page load, is there any technique or some way out to keep the function in cookie or storage (local, session) to later give eval ()?
I do not advise keeping the information in function . It would be best to modify the code and store only the required keys.
In addition, local storage is not recommended for storing session information or "sensitive" data ( source >).
In this case, it would be more appropriate to use a cookie . If possible, use HTTPS
and the flag secure
enabled, which helps to avoid some man-in-the-middle attacks. As you need to access the key in JavaScript, you will not be able to fire httpOnly
, so your page will be susceptible to Cross-Site Scripting (XSS) attacks.
But understand that any key recorded in the client does not offer good levels of security, it almost does not even use any session id , anyway anyone who can access their page information replicate the "natural" behavior of the system.