0
votes

I created a plugin for a Wordpress website. Based on whether a user visited an (important) subpage, the plugin presents personalized information in the header of the website - on every page and pageload.

In the past I used a cookie that stored this information. But I learned this particular usage of cookies prevent caching and thus reduces my website performance

Now I am trying to implement the same functionality with local storage.

Question: Will the use of localstorage and presenting user specific information on the website via jQuery also slow down my website? Or will I see better performance of the website?

1
if its dynamic per user, caching is not an option.user9487972
How long do you store that they've been to a specific page? Is this per session, only ever time they login? Once per user?James
When I used the cookie, I stored the data for 30 days. But if it's less, that would be okay. If the data expires after every window close, that wouldn't be the best situationBen Spi
You will see very huges benefits, and is much easier to handle: localStorage.setItem('entry', 'value') localStorage.getItem('entry') straightforward! ;) You can store many Gb like this. Need 10% empty hard drive to develop, or your browser may completly skip it without warning. Best to know it!NVRM
You aren't really changing the performance by using localStorage. What you are changing that matters is how you are gettting the user-info, not how you store it. By having the user-data retrieved by an ajax call, independent of the main page, you are improving a few things : 1) you aren't sending the data (via cookies) on every page request. 2) you are allowing those documents to be cached (and the user data request to be cached), 3) you are making dedicated requests for what you need, so you aren't making redundant requests to achieve multiple things.Anthony

1 Answers

0
votes

The data can be stored at the client side if you don't need it on the server and there are no sensitive information. It will reduce the request and response size and therefore reduce server load and response times. It won't affect caching, since your wordpress page is dynamic anyways and probably won't cache at all without caching plugins.