"be consistent" | |
PerlMonks |
Re: Removing Javascriptby joe++ (Friar) |
on Jan 02, 2003 at 20:22 UTC ( [id://223845]=note: print w/replies, xml ) | Need Help?? |
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: 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). --
In Section
Seekers of Perl Wisdom
|
|