YOU CAN NOT FORCE THE BROWSER TO MAKE A REFRESH utilizing HTML. (Only the user can "reload" or "refresh" the page wich means to repeat the request for the document(s) from the server) with all parameteres unchanged utilizing his / her browser. It's a client side action)

You can REDIRECT THE BROWSER to a URL utilzing HTML even if this is the same as the former one.

Why I prenounce that is simply the way the browser requests a page. When a browser requests a document from a webserver that browser will also remit ALL cookies originating from that webservers qualified domain and all those cookies which the browser is additionally allowed to submit to that specific web server. In repsonse the webser will return the requested document AND the new cookies. If a new cookie has the same identifier as one previously written by the same server the old cookie will be overwritten or actualized so to speak.) So when your script is being executed due to a call for your scripts URI the webserver will hand all received data to your script. When using CGI.pm you have an easy task. Simply write the new cookies before you start delivering content as the cookies are being sent in the document header.

A small example:

#!/usr/bin/perl -wT use strict; $|++; use CGI qw/:standard /; use CGI::Cookie; # dont allow that tiny script to crack this server $CGI::DISABLE_UPLOADS = 1; # set this to a reasonable high amount preventing server attacks with +posting hughe files $CGI::POST_MAX = 15000; # please identify, somehow my $usrPc = remote_host(); # if you've been here before, tell me, as whom you identified my $usrWasLast = (cookie('ID'))? cookie('ID'):'none'; # what kinda browser ? my $usrAgent = user_agent(); # well, get a cookie, please accept it, and if not, I don't need that +info from you anyway :-) my $hiddenInfo = new CGI::Cookie( -name=>'ID', -value=>$usrPc, -expires=>'+3M', -domain=>'little.perlmonk.org' ); my $referrer = param('ref') if (param('ref')); # now give the browser what it requested print header( -charset=>'iso-8859-1', -cookie=>[$hiddenInfo] ); print start_html( -dtd=>'-//W3C//DTD HTML 4.01 Transitional//EN', -lang=> 'en', -title=> 'yourPageTITLE' ); print p(($usrWasLast)? "You've been here before using IP: " . $usrWasL +ast : "I don't know you."); print p('You have followed a link to this site from' . $referrer) if d +efined $referrer; print end_html(); # 1;

Have a nice day
All decision is left to your taste


In reply to Re: how to refresh a page immediately by little
in thread how to refresh a page immediately by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.