The search engine is indexing javascript inside of <SCRIPT> tags. See #257076.

The solution is to put script javascript inside an HTML comment. This is what we had to do in the 1990's when some browsers didn't support script. And I think it's still good practice.

<script><!-- --></script>

But the search engine should know that some people don't write good HTML, and should know to just skip these.

CommentFileSizeAuthor
#3 257196.patch2.68 KBdouggreen
#1 257196.patch1.15 KBdouggreen

Comments

douggreen’s picture

Status: Active » Needs work
StatusFileSize
new1.15 KB

It appears that drupal_add_js inline is not doing this, and I think it should. So a first step, is to get our own HTML to write the javascript inside an HTML comment.

douggreen’s picture

Although W3C says this works, this blog says that it doesn't. And the patch seems to break javascript on FF2. Guess it's back to just ignoring this in indexing.

douggreen’s picture

Status: Needs work » Needs review
StatusFileSize
new2.68 KB

This method (<!-- -->) does work, ignore comment #2. The attached patch fixes the problem inherent in drupal_add_js, and adds a test case.

lilou’s picture

Status: Needs review » Needs work
douggreen’s picture

Priority: Normal » Critical

Is this still an issue?

sreynen’s picture

Because #158992: Inline JavaScript is XHTML invalid already comments out JS (the suggested solution here), I don't believe there's anything left to do on this issue.

klausi’s picture

Status: Needs work » Fixed

Jap, that should be fixed now.

Status: Fixed » Closed (fixed)

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