in reply to Removing Javascript

Hi Mur (Jeff?),

The problem here is - as always - the behaviour of some web browsers, that actually render the most crappy html/javascript code when they really shouldn't.

BTW, I'm intrpreting your second code example as being Javascript, rather than PHP (what it more looks like), so it would read like this:

<script language="Javascript"> document.write("Always use </script>!"); </script>
Anyway, in order to cope with this kind of crap I normally try a combination of HTML Tidy and/or LibXML's xmllint with the proper flags to accept and correct malformed html as input.

Then, if your source can be corrected this way and converted into well formed xhtml, you even can think of applying a very minimal XSLT stylesheet which leaves out all the <script/> elements.

(yes, I know, this has nothing to do with Perl, but this is how I solved this kind of problems many times already).

--
Cheers, Joe