Solved

HTML page/CGI script loading EVERTIME: No CACHE!

Posted on 1997-11-01
7
225 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

862 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now