Forum Moderators: coopster
I wrote a PHP program to run in my computer (I use this program as a application and in IE)
I have a huge problem and that is caching in browsers.
for example when I add a record , my program refresh the page but the new record don't listed so I should refresh the page with Ctrl+F5 to view new record.
what should I do ?
I use AJAX for this list of records and many of this program use JavaScript codes.
P.S: sorry for my bad English .
Regards,
Majid
[edited by: Majid at 12:50 pm (utc) on May 24, 2008]
Try using this at the very top of the file and it may helpful to you!
- John
<?php
//Set content-type and other headers to prevent cache:
// header('Content-type: application/javascript');
header('Expires: Tue, 22 May 1988 03:20:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, n0-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');