Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

The W3C validator shows a "cannot generate system identifier for general entity" error when attempting to validate a page that contains the following code:

<script type="text/javascript" src="http://view.light-speed.com/teamspeak3.php?IP=85.236.100.27&PORT=27617&QUERY=20274&UID=506987&display=none&font=12px&background=transparent&server_info_background=transparent&server_info_text=%23640d04&server_name_background=transparent&server_name_text=%23640d04&info_background=transparent&channel_background=transparent&channel_text=%23640d04&username_background=transparent&username_text=%23640d04"></script>

How do I get the validator to ignore this code when testing for errors?

share|improve this question
    
Just a point... On your page, you have missed the first line of your script from the CDATA section. –  w3d Aug 21 '12 at 16:13
    
Hi Jon, and welcome to Pro Webmasters! Thanks for your question. I've edited it to simplify it a little, and I've also provided an answer below that should help. (When asking a question, it's best to write it in a way that will help future visitors who have the same problem. i.e. by explaining the problem in its simplest form, without specific links to your own site if you can avoid them.) Hope that helps! –  Nick Aug 21 '12 at 16:18
add comment

1 Answer

up vote 3 down vote accepted

The W3C's validator tool offers cryptic error messages, but it actually gives you the answer to solve this. It complains about the line you've highlighted with the message:

"The most common cause of this error is unencoded ampersands in URLs"

This means you need to encode the ampersands in any scripts you include by using &amp; instead of &. So instead of this:

<script type="text/javascript" src="http://view.light-speed.com/teamspeak3.php?IP=85.236.100.27&PORT=27617&QUERY=20274&UID=506987&display=none&font=12px&background=transparent&server_info_background=transparent&server_info_text=%23640d04&server_name_background=transparent&server_name_text=%23640d04&info_background=transparent&channel_background=transparent&channel_text=%23640d04&username_background=transparent&username_text=%23640d04"></script>

You need to use this (scroll to the right to see that the & have been replaced with&amp;):

<script type="text/javascript" src="http://view.light-speed.com/teamspeak3.php?IP=85.236.100.27&amp;PORT=27617&amp;QUERY=20274&amp;UID=506987&amp;display=none&amp;font=12px&amp;background=transparent&amp;server_info_background=transparent&amp;server_info_text=%23640d04&amp;server_name_background=transparent&amp;server_name_text=%23640d04&amp;info_background=transparent&amp;channel_background=transparent&amp;channel_text=%23640d04&amp;username_background=transparent&amp;username_text=%23640d04"></script>

Replacing that line will solve many of your errors. You can read more about the reason this is necessary in the common errors page that W3 links to from their validator.

share|improve this answer
    
Thank you very much for the excellent help. After pasting that code in I get 0 errors from w3c. Im not actually too good with javascript, can get by editing certain things but not much. However what you said actually seems pretty straightforward. Ill know how to deal with this in the future. –  Jon Edwards Aug 21 '12 at 16:50
    
@JonEdwards You're welcome! (And if the answer solved your problem, you can mark it as accepted by clicking the check mark that appears underneath the arrows to the left of this answer. More info here.) –  Nick Aug 21 '12 at 16:53
    
I also fixed the cdata part at the top. Id pasted it in one line too late. Thanks for noticing now fixed. –  Jon Edwards Aug 21 '12 at 16:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.