Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Preventing Page Caching - All Browsers

Status
Not open for further replies.

Krus1972

Programmer
Mar 18, 2004
145
US
I am looking for an effective way to prevent ALL or MOST browsers from caching my webpages. Its important that the browser pulls the pages from the server EVERYTIME they are visited no matter what the users' browser settings are. I've used the following Meta Tags in the head on my pages but IE6 is still caching them, can anyone help?

My HTML code:

<head>
<meta http-equiv="expires" content="0">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache, must-revalidate">
</head>


Thanks,

Jeff



 
The following normally work for me:

Code:
<meta http-equiv="expires" content="Mon, 5 Jan 2004 11:00:00 GMT" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="pragma" content="no-cache" />

Of course, it is possible that your IE cache settings are overriding these - so you might want to check them out.

Hope this helps,
Dan

[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
BillyRayPreachersSon,

Does the "/" have to be placed just before the ">" I've never seen this before.

Jeff
 
All meta tags should terminate with />

For further guidance see:

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Essex Steam UK for steam enthusiasts
 

Only for XHTML compliance.

Dan


[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
Hence 'should terminate ' rather than 'must terminate' [smile] - I would advocate standard compliance as a norm

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Essex Steam UK for steam enthusiasts
 
For compliance sake:

Remember that it's not just meta tags. All tags SHOULD have a closing tag. If a tag is it's own closing tag, then it's not needed.

<br> and <hr> should be <br/> and <hr/>.

While <p> without a close was accepted in HTML (because paragraphs can't be nested in outher paragraphs), XHTML compliance requires both opening and a closing tag (<p> this is a paragraph</p><p>next one</p>). Same is true for List Item tags.

[plug=shameless]
[/plug]
 
Two languages, two rules.

In XHTML, all tags must be closed (because XHTML is a flavour of XML, and that's the XML rule). You can do this explicitly:
Code:
<foo></foo>
or use some XML shorthand to do it implicitly
Code:
<foo/>
However, Internet Explorer doesn't really understand X(HT)ML, and will choke on the implicit syntax unless you put a space before the /:
Code:
<foo />

In HTML, which only has to comply with SGML rules, some elements must not be closed. For example, this is invalid HTML (but valid XHTML):
Code:
<br></br>
[code]
The validator will accept <br />, because the trailing slash has some technical (and widely ignored) SGML meaning which makes it OK.

For other HTML elements, like <p>, a closing tag is optional.


Personally, I think it's easier to do the XHTML thing, and close all elements. But your page will probably look the same whatever you do.

-- Chris Hunt
[url=http://www.mcgonagall-online.org.uk][i]Webmaster &  Tragedian[/i][/url]
[url=http://www.extraconnections.co.uk]Extra Connections Ltd[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top