[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Why the HREF does not display the current contents of a file

Posted on 1997-06-05
3
Medium Priority
?
191 Views
Last Modified: 2013-12-25
Dear CGI experts,

My perl script create HTML codes that contain an Hypertext link to a text file. If I append some items to the file, run the script again, and click on the Hypertext link then I can only see the previous version of the file. The only way to display the current version of the file is to use a 'Reload' botton of a WWW browser. I understand my perl script creates only an HREF link, not contents of the file, so I think clicking on the HREF should always display the current contents of the file. I am using Netscape Navigator V 3.01 and my perl script is using the 'POST' method  as a 'request method'.
My perl script was written as follows. Thanks in advance.

-----------------------------------------
#!/usr/local/bin/perl
print "Content-type: text/html", "\n\n";
$request_method = $ENV{'REQUEST_METHOD'};

if ($request_method eq "GET") {
    $form_info = $ENV{'QUERY_STRING'};
}
else {
    $size_of_form_information = $ENV{'CONTENT_LENGTH'};
     read (STDIN, $form_info, $size_of_form_information);
}
.
.
.
print<<"print_tag";
....
<A HREF="http://www.lan.ac.uk/~user9/files/log_$comp_id.txt">View the contents of a file</A>   <BR>
....
print_tag
-----------------------------------------------------
Note that $comp_id is a variable where the value of a parameter is stored.
0
Comment
Question by:dcs0ock
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
icd earned 80 total points
ID: 1828179
I had a similar problem with gif images that were generated on the fly. You can change the code to:-

<A HREF="http://www.lan.ac.uk/~user9/files/log_$comp_id.txt?$foo">View the contents of a file</A><BR>

Where $foo is a new number each time the page is modified. You could either increment a counter or use the current time of day.
This will fool the browser into thinking it is a different URL each time even though the GET parameter is not used.
0
 

Author Comment

by:dcs0ock
ID: 1828180
Dear ICD,

Thank you very much for your excellent answer. It works ok now.
But most of end users probably don't realise that they have to rerun(reload) a specific perl script in order to get the current file information. Is there any other way to get the current information without rerunning the perl script whenever end
users click on an HREF link?
Many thanks.
0
 
LVL 5

Expert Comment

by:icd
ID: 1828181
Well, there are techniques to reload a document periodically although I am not very familiar with them. Client pull and server push.

Client pull means the client periodically re-requests the document.
Server push means the server sends the document whenever it changes.

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
The viewer will learn how to dynamically set the form action using jQuery.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question