Solved

Using cookies to store chunks of HTML?

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

How our DevOps Teams Maximize Uptime

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

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Add O365 Email SSO to our Portal? 7 30
Microsoft Azure Site-to-Site Tunnel to On-Prem 7 34
Syntax Issue with SSIS module 26 100
Vb.net threads keep increasing 2 34
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…
In the market for a new backup solution for Windows Server 2016? Follow these guidelines to get the most bang for your buck.
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

765 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