SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Are these ok in strict ?

    In:
    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    are these 2 ok please:
    HTML Code:
    <meta http-equiv="pragma" CONTENT="no-cache" />
    <meta http-equiv="expires" CONTENT="-1" />

  2. #2
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    The answer is NO those two attributes called content must be spelt in lower-case NOT UPPERCASE.

  3. #3
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Robert - that's appreciated. Also, is <script language="JavaScript" type="text/javascript"> ok please?

  4. #4
    SitePoint Addict EarlyOut's Avatar
    Join Date
    Mar 2011
    Location
    Sector R
    Posts
    280
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The "language" attribute is deprecated, and not necessary.

  5. #5
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So, just to be clear, it should now be :
    Code:
    <script ="JavaScript" type="text/javascript">
    There's a capital letter in there - is that still ok, in strict ?

  6. #6
    SitePoint Addict EarlyOut's Avatar
    Join Date
    Mar 2011
    Location
    Sector R
    Posts
    280
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, it should be:

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

  7. #7
    SitePoint Wizard
    Join Date
    Jun 2005
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

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

  8. #8
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.
    Simon Pieters

  9. #9
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,208
    Mentioned
    456 Post(s)
    Tagged
    8 Thread(s)
    Even this is OK these days,

    Code:
    <script src="whatever.js"></script>
    as browsers assume that the script is JS anyway.

  10. #10
    SitePoint Addict EarlyOut's Avatar
    Join Date
    Mar 2011
    Location
    Sector R
    Posts
    280
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    Even this is OK these days,

    Code:
    <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.

  11. #11
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,836
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    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) {}
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •