Solved

HTML page/CGI script loading EVERTIME: No CACHE!

Posted on 1997-11-01
7
230 Views
Last Modified: 2013-11-18
Are there any HTML or Javascript commands which will allow
me to call HTML pages or CGI scripts anywhere in my HTML/
JAVASCRIPT code?

I am presently using the <IMG> tag to load my CGI script which checks the clock on the server and sends back the binary code of a .GIF file representing the graphical time. The problem with it comes when the screen is resized or a user leaves and later comes back.  The browser caches everything and so my <IMG> tag with the CGI call is never called again only showing a "static" incorrect time.

Once again, are there any HTML or Javascript commands which will allow me to call HTML pages or CGI scripts anywhere in my HTML/JAVASCRIPT code and won't be cached so that the load will always be a genuine load?
0
Comment
Question by:ljaques
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 6

Accepted Solution

by:
Holger101497 earned 20 total points
ID: 1272184
If you include this line in the <HEAD> section of your document, the browser should not create a cache-file for your page:
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
As you said: NO CACHE *g* ;-)

Let me know if that solved your problem.

P.S.: Alternatively, you could include
<META HTTP-EQUIV="Expires" CONTENT="Sat, 01 Nov 1997 16:00:00 GMT">

Good luck!
0
 
LVL 6

Expert Comment

by:alamo
ID: 1272185
Sorry Holger, right idea but I don't think that will solve his problem - hope I am reading this one correctly  :-)

It's not his main page that has a problem being cached, it's the IMG sent by his CGI script. So no-cacheing the main page will cause the page to be reloaded even though it hasn't changed, yet the image showing the time will itself still be cached.

Add the headers to the output of the cgi script:

Expires: Sat, 01 Nov 1997 16:00:00 GMT
Pragma: no-cache

0
 

Expert Comment

by:jujoo
ID: 1272186
Alamo, in the CGI script don't you output the:
         Content-type: text/html\n\n
header first?  Does he have to place:
  Expires: Sat, 01 Nov 1997 16:00:00 GMT
  Pragma: no-cache
before or after it...
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 

Expert Comment

by:jujoo
ID: 1272187
Alamo, in the CGI script don't you output the:
         Content-type: text/html\n\n
header first?  Does he have to place:
  Expires: Sat, 01 Nov 1997 16:00:00 GMT
  Pragma: no-cache
before or after it...
0
 
LVL 6

Expert Comment

by:alamo
ID: 1272188
jujoo, I don't think the order of headers is that important, though I can't say I am certain since I always by convention put the Content-type: text/html header first. I'll have to look into this.

One thing though - the \n\n at the end of the Content-type: text/html header in your example causes a blank line, and THAT will end the headers and prevent the others from working. The extra \n always has to be on your final header.
0
 
LVL 6

Expert Comment

by:Holger101497
ID: 1272189
hmm... did my answer solve your problem or not?
If it didn't, you should reject it instead of giving a D
If it did, I don't see why I would get a D!!
I'd actually rather pass on the 22 points than get a D in my profile...(the only other grade lower than B was an "accident" and not intended...)
0
 

Author Comment

by:ljaques
ID: 1272190
Holger, I really apologize for that.  It was actually an accident.  It was supposed to be a B but it was sent off (and stranbgely enough the CGI reacted quickly for once).  Whjat can I do to correct the mistake to my real value of B?

I'd appreciate your help.  You are a very brainy guy Holger and have helped me before and I'd hate for you to avoid because of this accidental mistake.

BTW: Anyone know what to get caching to work for MS Explorer 3.0 and Netscape 2.0 and down?  These browsers seem to insist on having cache remain on (I can't turn them off via HTML).


0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

776 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