Solved

html not from the cache

Posted on 1998-12-02
12
197 Views
Last Modified: 2013-12-25
I preparing html pages using cgi program (written in java).
Because few links in my site are running the program, which
prepare as output an html page out of database, I want that when someone press on those links the browser will not go to the cache but to the program and will 'build' the page again. how can I do it without changing the browser's preferences ???
0
Comment
Question by:neta
[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
  • 5
  • 3
  • 2
  • +1
12 Comments
 
LVL 1

Expert Comment

by:ptruman
ID: 1829847
IIRC, any link to a program/cgi etc will NOT load from the cache.
Esp. if you build an expiry META into your HTML output....

0
 
LVL 11

Expert Comment

by:mouatts
ID: 1829848
ptruman is partially correct in that normally CGI is not loaded however this is not always the case. Generally the Web Server does not output any HTTP headers on a CGI call as it leaves this for the CGI call to do. So it then depends on how the browser works. IE3 has a nasty habit of caching CGI output when it doesn't understand the extension of the link (ie it isn't .cgi which it doesn't have to be). Such behaviour is totally contrary to the HTTP standard but you try telling Microsoft.

To counter this your CGI will need to output the pragma no-cache HTTP header.

ptruman is incorrect to suggest a Meta tag as the head section of CGI output is not normally parsed by the server and as I keep saying in various answers the browsers don't read the HTTP-EQUIV meta tags either.


Steve
0
 
LVL 11

Expert Comment

by:mouatts
ID: 1829849
A minor point the expiry tag will always cause a page to be stored in the cache even though the next time it is accessed it will be discarded and a new one fetched.

Using the expirey trick was used to support browsers that didn't support the no-cache pragma. Such browsers are very rare today.

steve
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 1

Expert Comment

by:ptruman
ID: 1829850
I didnt say META's are normally passed by the server.
You *can* send them as part of your HTML output  :

Content-type: text/html

<HTML>
<META .... etc>

Your browser should then say "Content Expired, Refresh?"
or auto refresh for you when you try and re-hit the page
using back/forward buttons.
IE4 however is too thick to do this.

0
 

Author Comment

by:neta
ID: 1829851
I did not understand what should I do.
I even did not understand the theory, but this is not important.
please try to give me an example of the code I need to add to my html-page made out of a CGI program.
thank anyway, neta.
0
 

Author Comment

by:neta
ID: 1829852
Hello All !!
Tank for your time !
 
Can any one tell me what the META tag should do?
and were should i put it in my html code

To remind you all !!
I Dont want the browser do a downlod from the cache i want
new html page  only from the new conection what should i write in my html code !!!



0
 
LVL 8

Accepted Solution

by:
MaDdUCK earned 40 total points
ID: 1829853
The meta tag is not a very nice solution of what you want. It would be placed inbetween the <head></head> sections and read the following:

<meta http-equiv="expires" content="0">

this is good for HTML pages, but since you are using CGI, you have more powerful methods:

before you output "Content-type: text/html", write the following:

"Cache-control: no-cache"

in Perl, this would look like this then:

# this is the very first output your cgi should generate:

print "Cache-control: no-cache\r\n";
print "Content-type: text/html\r\n";
print "\r\n"; # don't forget the double newline to terminate http headers.

# the rest of your code goes here.

hope this helps.
MaDdUCK
0
 

Author Comment

by:neta
ID: 1829854
Tank you ALL
and specially YOU MaDdUCK !!

Sorry thats all my points next time i will give more !

Regards.


0
 

Author Comment

by:neta
ID: 1829855
Tank you ALL
and specially YOU MaDdUCK !!

Sorry thats all my points next time i will give more !

Regards.


0
 
LVL 11

Expert Comment

by:mouatts
ID: 1829856
With regard to ptrumans last comments. I thinh that my point was missed in that Metas ARE parsed by the server when the server is parsing headers and converted to HTTP messages and then output.

The browsers do not process HTTP-EQUIV headers and what ever you may think of IE4 it is not wrong in what it does.

Steve
0
 

Author Comment

by:neta
ID: 1829857
There is one more 'neta' who is pretend he is neta, but he is not- I will change my password to prevent him from pretending in the future.
I want to ask MaDdUCK about his suggestion:
Hi, you told mw to write: "Cache-control: no-cache" before the "Content-type: text/html\r\n". but it doesn't work. instead of getting the html page, I get its source code, starting with the line "Content-type: text/html\r\n". It run on unix system.
If you have other suggestions or if I can email you, it would be nice.
thanks, neta.
0
 
LVL 8

Expert Comment

by:MaDdUCK
ID: 1829858
I will look into this in a while. I have finals now and I am really swamped, but maybe on the weekend...
0

Featured Post

Tutorials alone can't teach real engineering

So we built better training tools.

-Hands-on Labs
-Instructor Mentoring
-Scenario-Based Tests
-Dedicated Cloud Servers

All at your fingertips. What are you waiting for?

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…
In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

617 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