Validate "Custom JavaScript Code" not having <script> tags added

prof_stoopid - March 9, 2008 - 13:16
Project:Google Analytics
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

When validating any of my sites's pages (http://ulf.kister.org/) by http://validator.w3.org/check?uri=referer the W3C validation service reports errors caused by the script tags inside the page's body.

Solution would probably be placing the script code inside the page header...

#1

hass - March 9, 2008 - 14:21
Title:Google Analytics breaks XMHTL-1.0 Strict Validation» Google Analytics breaks XHTML-1.0 Strict Validation

Next version allows switching to header, but this is not supported by google and us, too.

Your footer codes gets invalid, while you made it invalid yourself.

#2

prof_stoopid - March 9, 2008 - 14:22
Title:Google Analytics breaks XHTML-1.0 Strict Validation» Google Analytics breaks XMHTL-1.0 Strict Validation

Obsoleted by #1

Placing the script in the page's footer is probably smart by means of
- minimizing rendering delay
- registering only "real" page views where the user's browser has reliably at least loaded and rendered he whole page

therefore an optional placement inside the header and some explanatory words about the pros and cons of this option would do the trick even better...

#3

prof_stoopid - March 9, 2008 - 14:24

> while you made it invalid yourself.

What do you mean? How to avoid??

#4

hass - March 9, 2008 - 14:24
Title:Google Analytics breaks XMHTL-1.0 Strict Validation» Google Analytics breaks XHTML-1.0 Strict Validation
Category:bug report» support request

#5

hass - March 9, 2008 - 14:27

You placed script tags inside script tags, this makes the code invalid. Have you used "JavaScript Code" to add you own code? Read the docs below this text area...

#6

prof_stoopid - March 9, 2008 - 14:34

Stoopid me (my nick seems to be my manifesto :-). This solved the XHMTL 1.0 issue.

Thank you so much for the quick analysis and fix!

#7

hass - March 9, 2008 - 14:41
Title:Google Analytics breaks XHTML-1.0 Strict Validation» Validate "JavaScript Code" not having tags added
Category:support request» feature request

I'm moving this into a feature request.

We should validate if contend added into "JavaScript Code" section contains script tags.

#8

prof_stoopid - March 9, 2008 - 14:44

This would at least make it a little more fool proof for users like me ;-)

Thanks again for the incredibly quick answers and assistence!

#9

hass - March 9, 2008 - 14:47

Only for me... why are you adding ga.js twice? You should really REMOVE all your code added into the "JavaScript Code" text area.

#10

hass - March 9, 2008 - 15:10

DE: Sach mal... was machst Du da eigentlich? :-) Du musst in das JavaScript Feld *nichts* eingeben damit das Modul einwandfrei arbeitet! Man braucht dieses Textfeld nur für sehr wenige Spezialfälle... aktuell trackst Du jede Seite 2 mal.

#11

prof_stoopid - March 9, 2008 - 15:12

> why are you adding ga.js twice?

By mistake, i must admit. Fixed nox.

Thank you again!

#12

reli4nt - March 25, 2008 - 20:06

The script tags should be escaped and that will allow them to validate.

<script type="text/javascript">
//<![CDATA[

JAVASCRIPT CODE HERE

//]]>
</script>

This is considered proper form and the safest way to include JavaScript in an (x)HTML document.

#13

hass - March 25, 2008 - 23:32

@reli4nt: no, the code inserted into the text area should not have any script tags at all. We need a regex testing for <script>$ on the end and the same one the beginning or better - there should be no script tag at all. I can think about some edge cases where this might limit somebody, but it's the only save way.

#14

hass - April 18, 2008 - 06:18
Title:Validate "JavaScript Code" not having tags added» Validate "Custom JavaScript Code" not having tags added

#15

hass - May 3, 2008 - 13:34
Version:6.x-1.0» 6.x-1.x-dev
Status:active» fixed

Solved in D5 and D6.

#16

Anonymous (not verified) - May 17, 2008 - 13:41
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.