Advertisements

xyZed wrote:
> Although related to false javascript errors during validation checks,
> this is a question about html validation.

It's about validation of HTML documents, but it's not about "false
javascript errors", just about common failures to understand what
validation is.
> I have several affiliate links stopping my pages validating. They use
> javascript which I don't understand.

Too bad. Your choice: get rid of them or learn to understand what this
is about, then perhaps fix them.
> Apparently it's a known issue
> that html validators can erroneously flag javascript errors.

The _error_ here, assuming HTML 4 rules, is the presence of "</sc",
which starts an end tag. There is no such tag in HTML 4 and, besides, no
end tags are allowed within a <script> element. This has _nothing_ to do
with flagging JavaScript errors or processing JavaScript in any way.
> I can fix this by adding a back slash here <\/sc'+'ript>' as mentioned
> on
> http://www.htmlhelp.com/tools/validator/problems.html#script

Yes, or by using an external file. Or by other means, but these two are
the simplest, probably.
> I'm hoping someone can tell me if this is a legitimate fix and that it
> won't interfere with the javascript functions please

Huh? Do you expect the general level of expertise in this group to
exceed that of the people beging the www.htmlhelp.com site? Rest assured
it doesn't. But you can also check the _official_ (though sloppily
written) HTML 4 specification and see that the same method is suggested
there, though this has been hidden into an appendix:
http://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.3.2

Advertisements

xyZed wrote:
> I have several affiliate links stopping my pages validating. They use
> javascript which I don't understand. Apparently it's a known issue
> that html validators can erroneously flag javascript errors.

Firstly, the validator is not erroneous -- it is acting correctly -- your
HTML is invalid.

Secondly, there is no Javascript error. The Javascript is fine in itself;
it has simply been embedded into the HTML wrongly.
> I have read the information on this page
> http://www.htmlhelp.com/tools/validator/problems.html#script
> which offers a solution. But I do not want to accidently disable the
> javascript functions of my affiliate links by adding stuff I don't
> understand.

The solution proposed on that page is fine. It won't change how your
Javascript operates.

›
>› > I have several affiliate links stopping my pages validating. They use
>› > javascript which I don't understand.
>›
>› Too bad. Your choice: get rid of them or learn to understand what this
>› is about, then perhaps fix them.

Exactly why I posted. This is my first step.
>› > Apparently it's a known issue
>› > that html validators can erroneously flag javascript errors.
>›
>› It's not true at all.

They flag phantom html errors, not (as I said) javascript errors,
and of course it's not the fault of the html validators.

>› ... Another solution is to put JavaScript code into an external
>› file.

That may be a good idea, would it have advantages other than the one
discussed here I wonder? I'd have to look into how it would work for
affiliate links and banners that are different on each page though.
>› ..Yet another, often feasible and perhaps the best, is to remove the
>› JavaScript code or to replace it by something more robust (like
>› replacing a fake "JavaScript link" by a real link).

I have yet to learn about doing such things. I hate having to use
other people's rubbish code. It seems to me that the overwhelming
majority of affiliate link code is poorly coded javascript. You are
right that I should learn what code is being put on my site but I am
so busy running and updating my site I have not had time. I do need
the affiliate links though so it's something I've seen as a necessary
evil.

>› Firstly, the validator is not erroneous -- it is acting correctly -- your
>› HTML is invalid.
>› Secondly, there is no Javascript error. The Javascript is fine in itself;
>› it has simply been embedded into the HTML wrongly.

The validator is flagging erroneous errors, but only because the
poorly written javascript code fools the html validator into thinking
the code is html (or something like that) I think I mistakenly said
they were flagging javascript errors but the correct observation
should be they are flagging html errors in javascript code?

>› > I have read the information on this page
>› > http://www.htmlhelp.com/tools/validator/problems.html#script
>› > which offers a solution. But I do not want to accidently disable the
>› > javascript functions of my affiliate links by adding stuff I don't
>› > understand.
>›
>› The solution proposed on that page is fine. It won't change how your
>› Javascript operates.

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!