Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using cookies to store chunks of HTML?

Posted on 2014-01-29
3
Medium Priority
?
226 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 84

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

On Feb. 28, Amazon’s Simple Storage Service (S3) went down after an employee issued the wrong command during a debugging exercise. Among those affected were big names like Netflix, Spotify and Expedia.
Microsoft has changed the look and feel of Azure AD and Microsoft account sign-in pages so that you will have a more unified look and feel when moving between the two interfaces.
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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

604 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