Force refresh

How do I force a refresh on visitors’ browsers to the home page…


freewaytalk mailing list
email@hidden
Update your subscriptions at:

What are you trying to accomplish with this? Are they already on the home page, and you want the page to reload, or are they on another page and you want to send them to the home page unexpectedly?

Walter

On Feb 16, 2016, at 8:41 AM, Graham Meigh email@hidden wrote:

How do I force a refresh on visitors’ browsers to the home page…

http://dairydiary.co.uk


freewaytalk mailing list
email@hidden
Update your subscriptions at:
Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

I want the page to reload so that the reader sees the latest version and not the cached page.


freewaytalk mailing list
email@hidden
Update your subscriptions at:

This is how I worked it out, works brilliantly.

Richard


freewaytalk mailing list
email@hidden
Update your subscriptions at:

Not much help Richard. I have already searched for the solution and there are many opinions.

I was hoping for a solution from a trusted source here in the forum.


freewaytalk mailing list
email@hidden
Update your subscriptions at:

Normally ‘shift’ and hit the refresh button together. Sometimes (especially
Safari) can take a long time to really refresh its page. In modern browsers
you can go to their pref’s and hit ‘empty cache’ (under ‘network’
‘security’ or similar tabs)
That will do the job.

Andries

2016-02-17 12:26 GMT+01:00 Graham Meigh email@hidden:

Not much help Richard. I have already searched for the solution and there
are many opinions.

I was hoping for a solution from a trusted source here in the forum.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

It is a client’s website. I want the page to automatically refresh when loaded OR not to be cached.


freewaytalk mailing list
email@hidden
Update your subscriptions at:

This is (by design) not something you can really control from your end. The browser belongs to the user, and you can only offer it suggestions, not absolute control. Imagine how awful it would be if that was not the case – visit a random site, and it starts putting the moves on your browser.

If you are having trouble explaining to your client that the changes really are there, try asking them to visit the site in a different browser – one that they never use ordinarily.

Reloading the page (through a timed redirect or JavaScript) will only re-fetch the cached content. You can try redirecting to a URL that contains a querystring (yoursite.com?t=12345), but that’s not guaranteed to work either. The shift-reload trick does work, as does enabling developer tools and using the Clear Caches menu command. Ironically, the only people who will see stale content are the ones who visit it all the time (like the client). The vast majority of users will only visit once in a while, and thus their caches will be timed-out from the last time they visited, and they will see the latest.

This is a client education problem, not a technical problem.

Walter

On Feb 17, 2016, at 8:13 AM, Graham Meigh email@hidden wrote:

It is a client’s website. I want the page to automatically refresh when loaded OR not to be cached.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Thanks Walter. Out of interest, how do news sites work? Do they ask the browser not to cache the page? I lists bbc.co.uk quite a few times throughout the day via new windows and the site is always ‘live’.


freewaytalk mailing list
email@hidden
Update your subscriptions at:

I’m using this meta in order to prevent caching:

Cache-control: public, max-age=0, no-cache

Richard


freewaytalk mailing list
email@hidden
Update your subscriptions at:

Thanks Walter. Out of interest, how do news sites work? Do they ask the browser not to cache the page? I lists bbc.co.uk quite a few times throughout the day via new windows and the site is always ‘live’.

Yep, there are ways to ask the browser to either not cache, or to just have a very short cache time. Richard’s method will work if the issue is with the HTML caching. If the problem is with other files (CSS, JS), you probably need to set the cache time through the .htaccess file: http://calebgrove.com/articles/understanding-htaccess-for-humans#set-cache-expiration

I’ll often set the cache time to something rather short (5-10 minutes) for development versions of websites so that the client is less likely to run into cached data.

However, keep in mind that unless you are running a huge news site, short cache times are a bad idea on a public facing website. There’s a reason why browsers cache the files — it makes subsequent page visits much faster, and saves on bandwidth for the end user and you.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

News sites are built using a content-management system, and they usually set the last-updated date for the home page in a content header to whenever the last news item was added. News sites would be completely nuts to set their page to never cache, because they are dealing with a huge amount of traffic, and caches are very good at dealing with that.

Here’s what I used last time I needed to do this in PHP:

Of course all of this is taken care of for you in Ruby on Rails, which is all I use these days.

Walter

On Feb 17, 2016, at 9:53 AM, Graham Meigh email@hidden wrote:

Thanks Walter. Out of interest, how do news sites work?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Hi Walter. After the initial whoosh! of all the coding soaring over my head I understood the opening paragraph.


freewaytalk mailing list
email@hidden
Update your subscriptions at:

Most people visit most sites once in a great while. At default settings for cacheing (both in the browser and in intermediate servers and routers), most people therefore see whatever the latest content is. Unless you have a site that caters to a very specific audience, and offers frequent high-value-to-that-audience updates as part of its business plan (sports scores, lottery results, model train layout of the week), you really don’t ever need to do anything more than the defaults. If you do need to have your content freshness greater than that (for reasons as above), then you will need to do something more space-age, hence all the code whooshing. It would be a big mistake to set a static page that is normally trafficked to an aggressively short cache time-to-live, because you will be wasting time for people who could benefit from a longer-term cache.

Walter

On Feb 19, 2016, at 7:06 PM, Graham Meigh email@hidden wrote:

Hi Walter. After the initial whoosh! of all the coding soaring over my head I understood the opening paragraph.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options