Why <!-- beats <![CDATA[ for inline javascript
I guess everyone knows, that using:
2
3
myMagicFunction("This & That");
</script>
is pretty bad practice. The issue is, that the & should be escaped and read as & instead.
If you are reading this code with an Ajax-Request and it contains for instance unescaped & character, it will fail to load the xml properly and also fail executing the embedded javascript.
The workaround I see pretty often is the following (even suggested by w3schools):
2
3
4
5
<![CDATA[
myMagicFunction("This & That");
]]>
</script>
a better way is of course:
2
3
4
5
// <![CDATA[
myMagicFunction("This & That");
// ]]>
</script>
because it does not break any backwards compatibility to browsers, who do not get the cdata tag when in non xml mode.
This solution has one big problem: This claims the inner content to be included at this point and be escaped automaticly. And this valid html will be made visible to search engines.
Since I don't want anyone to count this comments as content for my website I am using the following solution for ages:
2
3
4
5
// <!--
myMagicFunction("This & That");
// -->
</script>
It works like a charm. If you are still using any of the previous solutions, please consider this solution as a replacement.
Messages
quero joga no seu serve :) so brasileiro
hello
hbgilabgiulanile
kakakkak kdd
how loggin jou in
hello
:)
yea
85.21.37.18:7777
mütissssssssssssssss
heloo
my name is Gunz
halo
grasss
eeeeeee moze neko da mi kaze kad udjem u igricu trazi mi pasvord pa login ali neznam sta da ukucam ... moze neko da mi kaze .... please....:(


