?
Solved

Single Page Application how to detect when new version is on server, if so refresh cache

Posted on 2014-03-13
3
Medium Priority
?
703 Views
Last Modified: 2014-03-26
Have a single page application that needs to refresh the users browser cache when a newer version is present on the server.

What needs to be done to detect a new version on the server and then what needs to be done in the code to force a refresh?

Thanks.

jquery, Hot Tub, breeze
0
Comment
Question by:Black_Trash
[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 58

Expert Comment

by:Gary
ID: 39927827
I suppose you could add an hidden field to the page containing a 'version'
On page load make an ajax request to your server for the current version and if different run

location.reload(true); // same as an hard refresh
0
 

Author Comment

by:Black_Trash
ID: 39943785
Gary,
  Thanks for posting the response..

Question within the SPA where do you thing a good place to insert the code:
"location.reload(true);"
at.

  Also when you refer to "location"  not sure what does.

Thanks,
Keith
0
 
LVL 58

Accepted Solution

by:
Gary earned 2000 total points
ID: 39944156
Are you using jquery or vanilla javascript?
It would be placed before the closing body tag as you would need for the page to 'load' before you could check if the version field was cached.
0

Featured Post

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

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

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…
Suggested Courses

777 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