• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Page not getting refreshed until I Manually refresh browser


I am having a weird problem. My view page is not getting refreshed until I manually hit refresh (and sometimes have to clear cache before it works).

It's just a view which takes it's data from table and displays it. When I add a record and click "View Records" link to go to my page; new data is not there. I have to then manually hit refresh before it appears.

Any ideas? Do I need to send no-cache headers or is it my browser acting up?

EDIT: It happens in FireFox, IE6 and Chrome

That is the way internet works Smile You only get a snapshot of the data at the time you request the url.

If you want to get the latest data everytime you need to write code that pushes the latest data to the surfers browsers.

Thanks. But that is not the problem (I'd use Ajax for that anyways).

My problem is, even after clicking the link AGAIN, I don't get refreshed data. My view is looping through a variable which gets its data from table. When I add a record and then CLICK on "View Records" link to see if that data is in there; new data is NOT there.

I tried clicking different links and then going back to "View Records" page but new data is still not there until I hit refresh; so normal GET doesn't work.

do you cache the "view records" page?

No. No caching.

I even checked if there's an auto cache setting in config.php but found none.

I also checked system/cache folder but there were no cached files in there.

Sounds like a simple logic problem - possibly your views are being generated before the data is actually inserted. Check your logic.

My add and view pages are different views in different functions.

In this case, I add it, get a message that it was done successfully and then manually click the link to view page. It doesn't go there automatically.

Its strange but I added following headers in my header file and it's working fine now

header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");

I checked the Response Headers and it came up with following:
Date: Thu, 01 Jan 2009 20:06:56 GMT
Server: Apache/2.2.8 (Win32) mod_ssl/2.2.8 OpenSSL/0.9.8g PHP/5.2.5 mod_jk/1.2.26 mod_auth_sspi/1.0.4
X-Powered-By: PHP/5.2.5
Content-Encoding: gzip
Vary: Accept-Encoding
Cache-Control: max-age=86400
Expires: Fri, 02 Jan 2009 20:06:56 GMT
Content-Length: 1266
Content-Type: text/html

200 OK

Apparently, it's asking browser to cache those results (Changed after I set headers). Are these set through CI?

I couldn't find the code anywhere so can it be my default server behavior?

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.