tags:

views:

38

answers:

3

I use HTMLPurify for disabling JavasSript in a textarea.

My problem is:

$config = HTMLPurifier_Config::createDefault();
$purifier = new HTMLPurifier();
$va = $purifier->purify($va);

This removes script tags, but does not remove [a href='javascript:...']link[/a]

What should I do to remove the bad links and retain good links?

A: 

Use regular expressions to scan the textareas content for invalid / unwanted tags.

Tom
No, with htmlpurify is possible see this page http://htmlpurifier.org/demo.php, but I can not find where it explains.
David
Ok, that was not clear from your initial post (no reference to html purifier)
Tom
I count *three* references to it in version 1 of the question (having gone back and looked at the first revision)
David Dorward
+1  A: 

Try setting the AllowedSchemes whitelist.

Marius
+1  A: 

The live demo is indeed filtering both href="javascript:... and onclick. You can see the demo here.

Maybe you are using an older version?

metrobalderas
now its ok, the solution was;$purifier = new HTMLPurifier($config);$config inside function, is a stupid problem, sorry
David