Solved

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

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
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.

717 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