Solved

Reloading a Page

Posted on 2003-11-06
8
181 Views
Last Modified: 2013-12-24
Hi

I'm having trouble getting Coldfusion to relaod a page automatically without the user having to press the 'refresh' button.

I have an Intranet home page which pulls in all sorts of info from a database, which includes such things as a Bulletin Board, etc.  If someone adds something new to the Bulletin Board and then goes back to the home page, the new item does not appear without the person pressing 'refresh'.

Everyone within the company is using IE.  I realise I can get people to change their IE settings by going to Tools > Internet Options > General. And then selecting 'Every visit to the page' under 'Check for newer versions of stored pages', but I don't like this solution and would prefer it to be done for the user automatically.

Any ideas?

Thanks in advance.
0
Comment
Question by:nelliott
  • 4
  • 2
  • 2
8 Comments
 
LVL 10

Assisted Solution

by:Mause
Mause earned 63 total points
ID: 9693264
try to add this to your page:
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
so the page is not cached

Mause
0
 
LVL 4

Accepted Solution

by:
procept earned 62 total points
ID: 9693303
Hi,

add the following lines to your home page:
<cfheader name="expires" value="#now()#">
<cfheader name="Pragma" value="no-cache">
<cfheader name="Cache-Control" value="no-cache, no-store, must-revalidate">

the last one is the same as Mause's META-Tag.

Unfortunately some browsers/proxies still cahce pages instead of those settings. The only way to avoid that is to add an URL parameter to each link, that makes the page unique:
<a href="myPage.cfm?rnd=#getTickCount()#">Click here</a>

Don't forget to use <CFOUTPUT> around those links!

HTH,

Chris

0
 
LVL 10

Expert Comment

by:Mause
ID: 9693429
Procept I think its better to use the value 0 instead of #now()#  (now() Returns the date and time of SERVER) so:
<cfheader name="expires" value="0">

That will do the trick

Mause
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 4

Expert Comment

by:procept
ID: 9693501
Mause,

I don't know whether 0 is better or now()....

But, I use those tags, plus (if that isn't enough) the getTickCount()-method, and, it works. :-))

Chris
0
 
LVL 10

Expert Comment

by:Mause
ID: 9693654
I also think it will work...

but (if Im 'not wrong) the date in meta-expires is GMT and not the local time and if the value is 0 it will be interpreted as in the past .

but on the other hand now() generate something like this:
{ts '2003-11-06 10:54:11'}
and does not look this
Tue, 20 Aug 1996 14:25:27 GMT
so i guess it will not take now() as a valid value (just like 0)


Mause
0
 

Author Comment

by:nelliott
ID: 9693945
Hi

Thanks for your advice.  I've tried all of these, but I'm still not getting the page to refresh.

Looks as though the browser is still caching my query, as when I change the Settings in IE the page will refresh automatically.

Is there anything I can do in the Coldfusion Administrator to change the settings?

Thanks in advance
0
 
LVL 10

Expert Comment

by:Mause
ID: 9694003
Did you open the page width these meta tags in it or was it still the old page!
make sure it is the page width these metatagss and then do something and go back to the homepage

Mause
0
 

Author Comment

by:nelliott
ID: 9694204
Bingo!

Lucky you were on the ball Mause, because I certainly wasn't!

Many Thnaks to you both for your advice.

Only fair to split the points I think!

Cheers
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Windows Server with multiple sites and SSL 14 66
Firewall Speed Issue 6 68
CFFILE upload help 98 159
Adding multiple JVM environments to RedHat 6 7 22
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…

809 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