Solved

HTML page/CGI script loading EVERTIME: No CACHE!

Posted on 1997-11-01
7
218 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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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 the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
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…

746 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

10 Experts available now in Live!

Get 1:1 Help Now