coding noscript in a standards compliance way

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nathj
    Recognized Expert Contributor
    • May 2007
    • 937

    coding noscript in a standards compliance way

    Hi,

    I am working on a site that will use JavaScript to validate user entered data at the client side prior to sending it to the server side.

    I also want to be able to provide a page that explains why scripts are used and how to turn them on.

    I also want the site to remain XHTML 1.1 valid. I have tried the following code, within the <head> section:
    Code:
    <noscript>
    <meta http-equiv="refresh" content="0; URL=requirement.php">
    </noscript>
    Unfortunately this does not validate. It is essential that the site is valid. How can I do this in a standards compliant way?

    Many thanks
    Nathan
  • prn
    Recognized Expert Contributor
    • Apr 2007
    • 254

    #2
    Hi Nathan,

    The noscript element does not allow a meta element inside it, so you can't do this. OTOH, you might try doing it the other way round. Consider having the link that would go to your validating page take you to the noscript explanation page instead with a javascript inside that would redirect to the real page you want. Then, if javascript is not available or not enabled, the explanation page would be displayed, but if javascript is enabled, the browser would redirect to where they were supposed to go.

    <disclaimer> I have not actually tried this! </disclaimer>

    That said, I don't see why you couldn't do it, both successfully and validly.

    Best Regards,
    Paul

    Comment

    • nathj
      Recognized Expert Contributor
      • May 2007
      • 937

      #3
      Originally posted by prn
      Hi Nathan,

      The noscript element does not allow a meta element inside it, so you can't do this. OTOH, you might try doing it the other way round. Consider having the link that would go to your validating page take you to the noscript explanation page instead with a javascript inside that would redirect to the real page you want. Then, if javascript is not available or not enabled, the explanation page would be displayed, but if javascript is enabled, the browser would redirect to where they were supposed to go.

      <disclaimer> I have not actually tried this! </disclaimer>

      That said, I don't see why you couldn't do it, both successfully and validly.

      Best Regards,
      Paul
      Paul,
      Thanks for stopping by. Flipping the logic round is an interesting idea, so you are saying that the page I load as noscript would become my homepage unless scripts were enabled in which case the index.php would be shown? Is that the idea?

      Nathan

      Comment

      Working...