in reply to Removing Javascript

Just a quickie here. If your intention is to strip out all javascript, then you have your work cut out. There's not just the script tags - there's the onMouseovers, onLoad and all the other event handlers.

Without knowing the context in which you want to strip - security? - it's hard to suggest best method.

What I would do, if possible, is work the other way round. Define a list of HTML tags/attributes that are valid and strip out everthing else.

.02

cLive ;-)

Replies are listed 'Best First'.
Re: Re: Removing Javascript
by Jenda (Abbot) on Jan 03, 2003 at 14:15 UTC

    You are right. HTML::TagFilter will help with this.

    Jenda

    P.S.: I have something similar here. I planned to release it as HTML::TagFilter when I'm satisfied with the code, but William was quicker :-)