Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

How can i do a expires to my page

by Anonymous Monk
on Jun 06, 2001 at 08:46 UTC ( #86114=perlquestion: print w/ replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm just new in perl, i wish to know how i can make my page to be expires, i had read the faq in Perl.com where in the starthtml putting a "Expires" and set the time for the page to be expires. but how is work actually. coz when i click on the back or refresh button the page still refresh. so what can i do. thnak you

Comment on How can i do a expires to my page
Re: How can i do a expires to my page
by Chady (Priest) on Jun 06, 2001 at 09:30 UTC

    if you're using expires, then you're doing the right thing... but if the page still shows up when you click back, this is the fault of your ISP probably having a cache that doesn't respect HTML headers..

    and what's with the refresh?? of course you'll see the page when you refresh it.. or do you want everyone to view it only once in their lifetime??

    Maybe the problem is with your code, that's how it should be:

    print $query->header(-type=>'text/html', -expires=>'-1d');

    Update: Re-read it, the expires is in the header not in the starthtml


    He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.

    Chady | http://chady.net/
Re: How can i do a expires to my page
by tachyon (Chancellor) on Jun 06, 2001 at 16:03 UTC

    Unfortunately not all browsers respect the expires directive, you might try the following to add the no cache pragma to the headers when you output the page you want to expire:

    tachyon

    # if using CGI.pm to generate output try: print $query->header( -type => 'text/html', -expires => '-1d', -Pragma => 'no-cache', -Cache-control => 'no-cache'); # if directly outputing try: print <<END_OF_HEADER; Status: 200 OK Expires: now Pragma: no-cache Cache-control: no-cache Content-type: text/html END_OF_HEADER

    This should generate a page expired message when you try to go back. </code>

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://86114]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2014-07-13 15:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (250 votes), past polls