Solved

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

Posted on 2014-03-13
3
618 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

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

Suggested Solutions

Title # Comments Views Activity
asp Google Map 2 65
Is sending authentication through SOAP secure? 3 38
Drop Down not working in mobile- Bootstrap 14 36
Display if field is NOT "" or NOT null 6 23
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
The viewer will learn how to dynamically set the form action using jQuery.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

696 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