|
|
|
|
![]() ![]() |
Jun 10 2005, 09:21 PM
Post
#1
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 407 Joined: 13-December 04 Member No.: 2,696 |
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 |
|
|
|
Jun 10 2005, 10:05 PM
Post
#2
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 117 Joined: 3-May 05 From: A Canadian South of the 49th Parallel Member No.: 6,544 |
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! |
|
|
|
Jun 11 2005, 05:58 AM
Post
#3
|
|
|
Trap Grand Marshal Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 1,203 Joined: 25-March 05 Member No.: 4,883 |
Can this be done without PHP... maybe just Javascript ? It can be useful for me if it's done on Javascript... |
|
|
|
Jun 11 2005, 07:03 AM
Post
#4
|
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 1,161 Joined: 9-May 05 From: Brisbane, QLD Member No.: 6,818 |
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. |
|
|
|
Jun 11 2005, 02:53 PM
Post
#5
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 117 Joined: 3-May 05 From: A Canadian South of the 49th Parallel Member No.: 6,544 |
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.. |
|
|
|
Jun 18 2005, 05:30 PM
Post
#6
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 629 Joined: 26-February 05 Member No.: 3,995 |
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. |
|
|
|
![]() ![]() |
Similar Topics
| Topics | Topics | |
|---|---|---|
|
|
|
|
Lo-Fi Version | Time is now: 2nd December 2008 - 01:24 PM |