Re: W3C validation link

On Thu, 08 Feb 2007 17:52:21 -0000, Steve Collins  
<Steve.Collins@adur.gov.uk> wrote:
> I have found that this : <a
> href="http://validator.w3.org/check?uri=referer">LINK TEXT</a>
>
> Allows me to add a page checking link to a webpage
>
> Is it possible to add a similar link that will check a page before that
>
> I want to have every page on my site link (pages a, b, c, d, e etc) to a
> single page on my site (page 1) and page 1 on my site links to your site
> using a link similar to the one above but it doesn't check page 1 it
> checks whatever page on my site sent the person to page 1 (eg pages a,
> b, c, d, e etc)
>
> I have tried using various combinations of parent document referrer and
> javascript:history.back(-1) and javascript:history.back(-2) but don't
> seem to be able to work a working link out
>
> DO YOU KNOW IF THIS IS POSSIBLE ... ???

"Referrer" refers to the page that the client came from, so you can't use  
that directly if the client goes through an intermediate page. You'll need  
to call the validator with the full URI, using this:

http://validator.w3.org/check?uri=http://www.example.org

That argument can be passed to your "intermediate" page by the previous  
page (as part of the location string), or it can be extracted as its  
referrer by a script in that pafe (note that this won't work if people  
have their browser set to hide the referrer).

For example, something like this:

document.write ('http://validator.w3.org/check?uri='+document.referrer);

Note that this won't work locally (i.e., when you test the files in your  
system as file:///...), only when you get them through HTTP.

You might want to check if document-referrer is empty before generating  
that line, and give an error message otherwiser.

RMN
~~~

Received on Friday, 9 February 2007 19:16:11 UTC