Are these ok in strict?


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">

are these 2 ok please:

<meta http-equiv="pragma" CONTENT="no-cache" />
<meta http-equiv="expires" CONTENT="-1" /> 

The answer is NO those two attributes called content must be spelt in lower-case NOT UPPERCASE. :slight_smile:

Thanks Robert - that’s appreciated. Also, is <script language=“JavaScript” type=“text/javascript”> ok please?

The “language” attribute is deprecated, and not necessary.

So, just to be clear, it should now be :

<script ="JavaScript" type="text/javascript">

There’s a capital letter in there - is that still ok, in strict ?

No, it should be:

<script type="text/javascript" src="whatever.js"></script>

Thanks EarlyOut - sorry, had pc probs so only just come back on here.

You should be setting cache control headers with HTTP, not <meta>. HTTP proxies don’t care about your <meta>s, and browsers are moving away from caring about them as well.

Even this is OK these days,

<script src="whatever.js"></script>

as browsers assume that the script is JS anyway.

I believe that while the “type” attribute is actually unnecessary, XHTML and HTML 4.01 validation will fail without it, while HTML5 recognizes that there is only JS. All part of life’s rich pageant. :wink:

You can actually separate JavaScript and JScript by adding the correct types rather than using the deprecated text/javascript - at least in all browsers except Opera which will incorrectly try to run when the type is text/jscript

Internet Explorer versions that only understand JScript and not JavaScript will not run the script when it is correctly identified as JavaScript usint type=“application/javascript” (which is the standard MIME type for JavaScript).

So to keep the two languages separate you’d just need to wrap the JScript inside

if (!window.opera) {}