Board index   FAQ   Search  
Register  Login
Board index php forum :: HTML HTML Basics

No Cache Needed !!

Discussing Html . Code , Software , other

Moderators: macek, egami, gesf

No Cache Needed !!

Postby d.shankar » Tue Mar 07, 2006 7:53 am

Heloo all..

I need a great help.. My site uses flash and when i update the flash file and put it in the server and refresh again.. The same old flash file is being showed..[because the files are getting cached in the browsers history]

I have used many meta tags to avoid caching.. but it seems failing..

Anyone have idea to overcome this problem ?? Please help me guys...
User avatar
d.shankar
New php-forum User
New php-forum User
 
Posts: 71
Joined: Fri Jul 29, 2005 2:17 am

Postby Coditor » Tue Mar 07, 2006 8:19 am

In these cases, I've always added a bogus parameter to the swf file, with a PHP random value:

src="myfile.swf?bogus=<?= mt_rand(1000, 9999) ?>"

That way it won't be cached. I know this sucks, but at least for development it helps.

Coditor
Coditor
New php-forum User
New php-forum User
 
Posts: 243
Joined: Wed Feb 01, 2006 9:18 am
Location: Netherlands

Postby revq » Wed Mar 08, 2006 2:20 am

Your other option is to do a forced refresh - when you see the page hold down ctrl + F5, or hold down ctrl while clicking on the refresh button - it will reload the entire web site, ignoring anything in the cache. This isnt exactly something you can expect the public to do so for a live site, Coditor's suggestion is good - but for changes to a site still in development this should help.
User avatar
revq
New php-forum User
New php-forum User
 
Posts: 21
Joined: Mon Feb 13, 2006 1:54 am
Location: South Africa

Postby Coditor » Wed Mar 08, 2006 3:59 am

Unfortunately that doens't always work for Flash movies. It looks like the Flash plugin uses it's own cache... :(
Coditor
New php-forum User
New php-forum User
 
Posts: 243
Joined: Wed Feb 01, 2006 9:18 am
Location: Netherlands

Postby d.shankar » Wed Mar 08, 2006 7:06 am

hi coditor & revq,

Yeah u r right i too have used the rand?<php echo(... to load a new flash file..

but as revq said , ctrl+F5 thing.. but users dont do it normally..

tried many things in meta tag but it not helping guys ??

anyother help would be greatly appreciated !!!
User avatar
d.shankar
New php-forum User
New php-forum User
 
Posts: 71
Joined: Fri Jul 29, 2005 2:17 am

Postby sanketce » Wed Mar 29, 2006 5:59 am

If your server supports PHP then try this in beginning...

use below code to disable caching:

Code: Select all
<?php
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
 
// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);

// HTTP/1.0
header("Pragma: no-cache");
?>
sanketce
New php-forum User
New php-forum User
 
Posts: 90
Joined: Fri Dec 02, 2005 3:23 am

Postby d.shankar » Wed Mar 29, 2006 1:35 pm

thanks sanket ...

i havent tried this.. will this work for all browsers ??
User avatar
d.shankar
New php-forum User
New php-forum User
 
Posts: 71
Joined: Fri Jul 29, 2005 2:17 am

Postby Coditor » Thu Mar 30, 2006 1:28 am

All browsers should recognize those headers and ignore/disable cache. Still, I don't know if the flashplayer does.
Coditor
New php-forum User
New php-forum User
 
Posts: 243
Joined: Wed Feb 01, 2006 9:18 am
Location: Netherlands

Postby d.shankar » Thu Mar 30, 2006 7:17 am

yeah thats the thing..

the flash player is the problem ..
User avatar
d.shankar
New php-forum User
New php-forum User
 
Posts: 71
Joined: Fri Jul 29, 2005 2:17 am

Postby sanketce » Thu Mar 30, 2006 9:06 pm

Sure this is server side code and supported by all browsers. Go ahead and check it out..
sanketce
New php-forum User
New php-forum User
 
Posts: 90
Joined: Fri Dec 02, 2005 3:23 am


Return to HTML Basics

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron