Hey there! Sign in to join this conversationNew here? Join for free
    • Thread Starter
    Offline

    15
    ReputationRep:
    For my coursework I need to build a website and one of the requirements is to include validation links to the w3c validator:

    https://validator.w3.org/

    For maximum marks I need to include a link on every page in my site which automatically validates the referring page (i.e. the page you clicked from). I've got the basic links but can't work out how to automatically validate my pages.

    For reference my pages will be running on a virtual server when being marked so I don't know off hand if I can simply provide the IP address of my server and the page link. Validating by upload or direct input doesn't seem like the right way to do it either though. Any help would be massively appreciated
    • TSR Group Staff
    Offline

    18
    ReputationRep:
    HTML validators? Seriously? Schools do so love to waste their IT students' time with irrelevant nonsense it seems.

    Anyway, if you go to their website and plug in a URL to the form you'll wind up on the validation page. If you look at the URL in the location bar, you'll see something like this:

    https://validator.w3.org/nu/?doc=https%3A%2F%2Fwww.google.co .uk%2F

    If you do a couple more you'll see the pattern, ?doc= followed by an encoded version of the URL you submitted.

    So to provide a link to the validation page automatically, you need to build the above URL, which will be something like

    Code:
    "https://validator.w3.org/nu/?doc=" + encodeURIComponent(location.href)
    Using JavaScript as an example here. Once you've plugged that in to your page you should be all set. Assuming your HTML is valid enough. :p:
    • Thread Starter
    Offline

    15
    ReputationRep:
    (Original post by Dez)
    HTML validators? Seriously? Schools do so love to waste their IT students' time with irrelevant nonsense it seems.

    Anyway, if you go to their website and plug in a URL to the form you'll wind up on the validation page. If you look at the URL in the location bar, you'll see something like this:

    https://validator.w3.org/nu/?doc=htt...oogle.co.uk%2F

    If you do a couple more you'll see the pattern, ?doc= followed by an encoded version of the URL you submitted.

    So to provide a link to the validation page automatically, you need to build the above URL, which will be something like

    Code:
    "https://validator.w3.org/nu/?doc=" + encodeURIComponent(location.href)
    Using JavaScript as an example here. Once you've plugged that in to your page you should be all set. Assuming your HTML is valid enough. :p:
    Perfect explanation thank you. It does seem pretty trivial but considering it's basically an intro to HTML course and I've just learned something I wouldn't say it's wasting my time I mean we get marks for things like not including our names (sites have to be anonymous) or linking stylesheets rather than using inline style tags so it's really not surprising that there's a mark for chucking the HTML into a validator to make sure it's correct. It's dumb but it's an entry level course. Some people strugge with writing a basic website so validating their HTML probably helps
    • TSR Group Staff
    Offline

    18
    ReputationRep:
    (Original post by Acsel)
    Perfect explanation thank you. It does seem pretty trivial but considering it's basically an intro to HTML course and I've just learned something I wouldn't say it's wasting my time I mean we get marks for things like not including our names (sites have to be anonymous) or linking stylesheets rather than using inline style tags so it's really not surprising that there's a mark for chucking the HTML into a validator to make sure it's correct. It's dumb but it's an entry level course. Some people strugge with writing a basic website so validating their HTML probably helps
    Writing correct HTML is useful to some extent but there's definitely more important things like performance, at least from my perspective. But hey, it teaches you a bit about URLs so I guess it's not all bad.
    • Thread Starter
    Offline

    15
    ReputationRep:
    (Original post by Dez)
    Writing correct HTML is useful to some extent but there's definitely more important things like performance, at least from my perspective. But hey, it teaches you a bit about URLs so I guess it's not all bad.
    While I don't disagree, it's difficult to teach us about performance when most people don't even have a basic grasp of HTML. IIRC performance is something we'd cover in our second year if we chose to do the web unit. This unit might as well be called introduction to HTML and CSS. It's the sort of thing that should have been covered at college level, or possibly even GCSE.
 
 
 
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • Poll
    Did TEF Bronze Award affect your UCAS choices?
    Useful resources
  • See more of what you like on The Student Room

    You can personalise what you see on TSR. Tell us a little about yourself to get started.

  • The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

    Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

    Quick reply
    Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.