How to add/update cookie variable in PlayCanvas

How to store cookie variables in browser.

Hi @Mohanraj_S,

This is more of a js question than a playcanvas specific question. Still, this thread on Stackoverflow should be able to help:

On the other hand, a lot of development is moving away from cookies as the amount you can save is small, and browsers are tightening restrictions on saving cookies. I would recommend using localStorage instead:

I find it more simple to use and just as effective as cookies.

1 Like

Thanks @eproasim.Is it possible to access local storage variables in other playcanvas projects or other html pages.

Hi @Mohanraj_S,

Much like cookies, localStorage is domain based, so if your projects are on the same domain, you will be able to set and retrieve localStorage entries across projects on the user’s device. Checkout this documentation on the localStorage API: