Solved

Using cookies to store chunks of HTML?

Posted on 2014-01-29
3
200 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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Most of the applications these days are on Cloud. Cloud is ubiquitous with many service providers in the market. Since it has many benefits such as cost reduction, software updates, remote access, disaster recovery and much more.
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

809 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