Advanced Search

Results 1 to 7 of 7

Thread: <noscript> and w3c

  1. #1
    Join Date
    Apr 2012
    Location
    Central New Jersey
    Posts
    130
    Thanks
    49
    Thanked 0 Times in 0 Posts

    Default <noscript> and w3c

    The w3c validator gives an error message when I try to validate http://www.njdriverslicenses.com/. The relevant code is...

    Code:
    &nbsp;&nbsp;<!-- Site Meter -->
    <script type="text/javascript" src="http://s50.sitemeter.com/js/counter.js?site=s50NJDrivers">
    </script>
    <noscript>
    <a href="http://s50.sitemeter.com/stats.asp?site=s50NJDrivers" target="_top">
    <img src="http://s50.sitemeter.com/meter.asp?site=s50NJDrivers" alt="Site Meter" border="0"/></a>
    </noscript>
    <!-- Copyright (c)2009 Site Meter -->
    It strikes me as pretty weird that <noscript> would flag where <script> is allowed. Can anyone see whether I am missing something?

    A.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,156
    Thanks
    262
    Thanked 690 Times in 678 Posts

    Default

    I think it might be because you're including that within a paragraph. I'm not sure why <script> is allowed, though.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,627
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    You're using an xhtml doctype.
    Quote Originally Posted by http://www.w3.org/TR/html5/scripting-1.html#the-noscript-element
    The noscript element must not be used in XML documents.
    You might want to reconsider using an xhtml doctype.
    • The xhtml specification is no longer under active development; it is effectively dead.
      It is allowed to use xhtml syntax with HTML5, but there's really no point in doing so.
      .
    • You won't run into obscure errors (like this one) anymore. There are many, many things in common practice that don't "jive" with xhtml. You're hard-pressed to find an xhtml document on the web that actually validates as xml.
      .
    • [true] xml does not allow graceful error handling: if a browser were to correctly parse this -
      Code:
      <!-- everything else is completely correct,
          but this img tag is not properly closed-->
          <img src="mypic.jpg">
      then it would fail, come to a complete stop in the middle of whatever it was doing, and refuse to do anything further. With the advent of HTML5, there are specific rules for handling mistakes in markup, so browsers will handle it in a graceful, predictable manner (even if it's not exactly what you wanted to happen).
      .
    • Your page (like almost all xhtml pages in existence) is not being served with the proper http headers (it's served as "text/html"), so no browser considers it xhtml anyway: it's being treated as "broken" html. Older versions of IE don't support xhtml at all, even with the proper http headers.
      (This is my #1 reason for abandoning xhtml: in practice, it has always been completely useless, and even a bit of a usability risk.)


    The current recommended doctype is <!doctype html>. This will trigger standards mode in all major browsers, and is completely backwards-compatible (back to the very first day any browser cared at all about doctypes).
    Last edited by traq; 02-13-2013 at 09:23 PM.
    We Only Torture the Folks We Don't Like (You're Probably Gonna Be Okay)
    It's a Party in the CIA

  4. The Following User Says Thank You to traq For This Useful Post:

    marain (02-13-2013)

  5. #4
    Join Date
    Apr 2012
    Location
    Central New Jersey
    Posts
    130
    Thanks
    49
    Thanked 0 Times in 0 Posts

    Default

    Traq, your surmise was correct: Taking the </noscript> outside the paragraph tags solved the problem.

    Now as to your other suggestion, were I to change the doctype as you suggest, can you give me a feel for what other changes would be required as a result? For example, would self closing tags, e.g. <br /> still work (and be accepted by w3c)?

    Thanks again.

    A.

  6. #5
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,627
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by marain View Post
    Traq, your surmise was correct: Taking the </noscript> outside the paragraph tags solved the problem.
    actually, Daniel said that.

    Quote Originally Posted by marain View Post
    Now as to your other suggestion, were I to change the doctype as you suggest, can you give me a feel for what other changes would be required as a result? For example, would self closing tags, e.g. <br /> still work (and be accepted by w3c)?
    It's perfectly acceptable to use an XML serialization (i.e., XHTML-style syntax) with HTML5.

    You can override the doctype in the validator to see what changes you might need to make if you switched. Mostly minor stuff, in the case of your home page. Unregistered meta names, obsolete attribute values, presentational ("should-be-in-CSS") attributes. Nothing that would actually cause problems.
    We Only Torture the Folks We Don't Like (You're Probably Gonna Be Okay)
    It's a Party in the CIA

  7. #6
    Join Date
    Apr 2012
    Location
    Central New Jersey
    Posts
    130
    Thanks
    49
    Thanked 0 Times in 0 Posts

    Default

    Dan, Traq, jscheuer1, beverleyh, it's difficult to keep things straight when I'm surrounded by geniuses ;-)

    Thanks all.

    A.
    Official Junior Coder

  8. #7
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,627
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    You're quite welcome. Just to clarify, my suggestion about changing the doctype was just that. If you're not sure about it, don't worry; it's not critical.
    We Only Torture the Folks We Don't Like (You're Probably Gonna Be Okay)
    It's a Party in the CIA

Similar Threads

  1. noscript + html comments
    By traq in forum JavaScript
    Replies: 2
    Last Post: 06-17-2010, 05:14 AM
  2. Switch Content - noscript collapsed?
    By StickBoy in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 09-03-2009, 09:17 PM
  3. Replies: 2
    Last Post: 12-27-2008, 04:19 AM
  4. Help with NOSCRIPT version
    By ro1960 in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 03-21-2007, 01:48 PM

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
  •