Jul 20, 2008

Forcing A Page To Not Load From Cache

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > HTML, XML etc..

free web hosting

Forcing A Page To Not Load From Cache

kvarnerexpress
I've developed a page that is composed of HTML and PHP and it pulls info from a DB to create a dynamic page. The one issue I'm seeing is that I'm having to hit refresh to get the page to pull information newly added to the DB. The browser seems to be pulling from cache. Is there a tag or script I can use to tell the browser to never pull this page from cache? Thanks.
kvarnerexpress

Reply

SystemWisdom
Using PHP:
CODE

if( !headers_sent() )
{   header('Expires: ' . gmdate('D, d M Y H:i:s') . 'GMT');
    header('Cache-control: no-cache');
}


Or using plain HTML:
CODE

<META HTTP-EQUIV="Expires" CONTENT="Tue, 04 Dec 1993 21:29:02 GMT">


Of course, you may put any expiration date, the ones above are merely examples, though they would expire the content immediatley!

I hope that helps!

Reply

Inspiron

Can this be done without PHP... maybe just Javascript ?
It can be useful for me if it's done on Javascript...

Reply

Tyssen
QUOTE(kvarnerexpress @ Jun 11 2005, 07:21 AM)
The one issue I'm seeing is that I'm having to hit refresh to get the page to pull information newly added to the DB.

So you're looking at a page, then you update the database and then you have to refresh your page to see the changes? Well I'm afraid that's the only way it's gonna work. How else is the page gonna update unless you refresh the browser?
Unless you're talking about having to refresh more than once to see the changes. If you're talking about just one single refresh, then that's completely normal.

Reply

SystemWisdom
QUOTE(Inspiron @ Jun 11 2005, 01:58 AM)
Can this be done without PHP... maybe just Javascript ?
It can be useful for me if it's done on Javascript...
*



QUOTE(SystemWisdom @ Jun 10 2005, 06:05 PM)
Or using plain HTML:
CODE

<META HTTP-EQUIV="Expires" CONTENT="Tue, 04 Dec 1993 21:29:02 GMT">


Of course, you may put any expiration date, the ones above are merely examples, though they would expire the content immediatley!


Yes, it can be done without PHP, just look at the example I posted using HTML.. biggrin.gif

 

 

 


Reply

beeseven
The thing about doing it in Javascript is that not everyone has Javascript enabled. If it's really important to make your pages dynamic, you should do it with something that people can't turn off.

That, and it may not even be possible to do it with Javascript.

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Recent Queries:-
  1. force web page not to look in cache - 28.76 hr back. (1)
  2. force no cache page jsp header wap - 29.66 hr back. (2)
  3. show page not from cache - 29.99 hr back. (1)
  4. pages load from cache - 32.64 hr back. (1)
  5. load page no cache - 33.20 hr back. (1)
Similar Topics

Keywords : forcing load cache

  1. Image Doesn't Load - (6)



Looking for forcing, page, load, cache

Searching Video's for forcing, page, load, cache
advertisement



Forcing A Page To Not Load From Cache



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE