Solved

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

Posted on 2014-03-13
3
537 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
  • 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 500 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This video teaches users how to migrate an existing Wordpress website to a new domain.
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.

758 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

16 Experts available now in Live!

Get 1:1 Help Now