Skip to main content.
home | support | download

Back to List Archive

Re: Javascript Showing in Descriptions

From: Bill Moseley <moseley(at)not-real.hank.org>
Date: Wed Jan 23 2002 - 16:45:38 GMT
At 07:29 AM 01/23/02 -0800, cmpeders@co.seminole.fl.us wrote:
>
>Hello,
>
>I have installed swish-e-2.1-dev-25 and built it with the libxml2.

Great!.

>I am
>still having the problem where it is giving me the code (as explained
>below). I am using the JSWISH CGI script. Is there something I need to set
>in the config files that keeps it from indexing the code like that? In the
>config to index I have set the DefaultContents and IndexContents to HTML2.

Yes,

  IgnoreMetaTags script style

I think that's in the archives, but I'll be a bit verbose here to help with
searches.  That will avoid indexing text inside of javascript and style tags.

Swish doesn't index comments by default so you might wonder why you can't
do this:

  <SCRIPT type="text/javascript">
    <!-- to hide script contents from old browsers
      function square(i) {
         document.write("The call passed ", i ," to the function.","<BR>")
         return i * i
      }
      document.write("The function returned ",square(5),".")
    // end hiding contents from old browsers -->   
  </SCRIPT>

The reason is that libxml2 correctly sets content inside of <script> as
CDATA and thus there really isn't an HTML comment in there.  So you need to
tell swish to ignore <script> tag.

The original HTML parser is broken, and in this case sees that as a comment.


-- 
Bill Moseley
mailto:moseley@hank.org
Received on Wed Jan 23 16:47:08 2002