How to whitelist just some attributes with HTMLpurifier?
-
21-08-2019 - |
Question
How to whitelist just some attributes with HTMLpurifier? I want HTMLpurifier to delete all the other, not allowed attributes.
Solution
HTML.AllowedAttributes. Note that when using HTML.AllowedAttributes, you need to also be using HTML.AllowedElements. And you'll probably need to add more as you go along. Like AllowedFrameTargets
for target=""
, AllowedRel
, AllowedRev
, EnableAttrID
, ... Not much choice but testing thoroughly.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow