in reply to Re: Stripping the contents of Javascript tags
in thread Stripping the contents of Javascript tags

A comment stripper should pick up on the MS garbage as well as normal comments
Personally I'd go for using HTML::Parser to reconstruct the file - a quick and dirty version would be something like:
use HTML::Parser; my $parser = HTML::Parser->new( api_version => 3, default_h => [sub { print $_[0] unless lc $_[1] eq 'script' }, 'te +xt,tagname'], comment_h=> [""], ); $parser->parse_file($file);
This won't handle any javascript event handlers, for that you would need to go through the attributes of each tag and remove the event handlers.
You would also need to check all your hrefs for javascript as well
Update: The comment stripping will work but the default handler I wrote won't remove the script properly.