Solved

Using cookies to store chunks of HTML?

Posted on 2014-01-29
3
195 Views
Last Modified: 2014-11-12
I have an intranet database system where the header has a list of the last 5 orders viewed and the last 5 clients viewed.

The database is actually on Azure, while the website had to be moved to an Amazon server.

(Trust me, there were specific reasons we got stuck with this)

So, each page, I have to go to the DB and back to the server for both the information on the page and this stuff, which ONLY changes when the user looks at a job or client.

When everything was on Azure, it was pretty snappy, but now there's a clear lag.  So here's my plan and maybe you folks can improve upon it.

(and I can't use session vars because we have load balancers, etc..)

I was thinking about taking the HTML in the div where I display these sets of links and just dropping it in a cookie.  When the hit a job or a client, I'd just update the cookie.  Then, when generating each page, I'd just use javascript to populate those divs with the cookie values.  (right now I actually pull them via ajax after the page loads.)

It's really only about 1k of data.

Since a cookie gets posted back to the server with every page, there's that extra load between client and webserver, but perhaps that's worth the reduction in traffic between the DB and the webserver and the additional stored proc call on the DB?

What would be really nice would be a way I could just have a cookie that didn't post back, but just some HTML that could be cached on the user's machine.  Maybe HTML5 has that?
0
Comment
Question by:Danielcmorris
  • 2
3 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39819331
I'm not sure about the idea.  You do have to provide for situations where the cookies are not remembered.  Some people frequently clear their cache and cookies and people using 'private' browsing erase cookies when the browser is closed.
0
 
LVL 4

Accepted Solution

by:
Danielcmorris earned 0 total points
ID: 39819344
I think I just found the solution.

HTML5 has localStorage, where it maintains the ability to store data on the user's computer as well as sessionStorage, which maintains the ability to store data that will be cleared out when the browser closes.

I'm going to cache the data in localStorage, rebuilding it on login.

-dan
0
 
LVL 4

Author Closing Comment

by:Danielcmorris
ID: 39829089
.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now