[pmwiki-users] Re: Formatting help?

Patrick R. Michaud pmichaud at pobox.com
Sat Oct 15 19:08:14 CDT 2005


On Tue, Oct 11, 2005 at 06:58:08AM +0000, Graham Poole wrote:
> So I seem to have found the problem.
> I'm guessing the host changed their banner code lately,
> and now FireFox reads it improperly.
> Somehow, IE reads it correctly (weird, I know).
> 
> The issue occurs at this point in the page source,
> right at the end of the banner code:
> 
> <SCRIPT language='JavaScript'>
> // <!--
> ...
> document.write('<script type="text/javascript"
> src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
> </script>');
> }
> // -->
> </SCRIPT>
> 
> The second-last /script is read and closes off the initial SCRIPT,
> as opposed to the script command directly before it.
> (I know this because FireFox highlights certain parts of page sources)
> This means the if statement isn't finished properly and
>       '); } // -->    gets ouput as plain text.

Your provider has the <SCRIPT> syntax incorrect.

The purpose of the <!--...--> comment here is to hide the script
data from browsers that don't understand the <SCRIPT> tag.  Fine,
but your provider got the placement of the "//" wrong -- the "//"
should go only after the closing "-->" and not before the leading 
"<!--".  In other words, the <SCRIPT> tag should be formatted
like this:

    <SCRIPT language='JavaScript'>
    <!--
    ...
    document.write('<script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>');
    }
    // -->
    </SCRIPT>

Note that there's no "//" before the leading "<!--".  This syntax 
was taken directly from the W3C HTML 4 specification on "Hiding 
script data from user agents", at 
http://www.w3.org/TR/html4/interact/scripts.html#h-18.3.2 .

> Somehow this exact code works fine on non-pmwiki pages...
> Any ideas why?  Or how to fix it?

I'm not exactly sure why it works in non-pmwiki pages but not
in pmwiki ones -- it may have something to do with slight
differences in the structure of the pages, or perhaps because
PmWiki is running some other javascript components before the
<body> tag (whereas the non-pmwiki pages are not).

At any rate, I'd see if you can get your hosting service to
fix this bug in their code and if that resolves the problem.

Pm




More information about the pmwiki-users mailing list