I'm using HTMLPurifier
to sanitize HTML string (it's about security).
Some attributes (like width
or height
) are removed when HTMLPurifier is called. I don't consider this as a security issue.
How can I add this attribute without redefining the whitelist ?
I searched on Stackoverflow and HTMLPurifier documentation, but the only solution seems to be :
$config->set('HTML.Allowed', 'p,b,a[href],i');
But this is not a solution, because I don't want to redefine the whitelist (I trust the default HTMLPurifier configuration, I just want to add an exception).
Also note invalid attributes will be stripped when using xhtml strict
--> Ok, thanks ! I usedwidth="100%"
and it's not valid. – Beaudoin