Search code examples
videoaudiotagshtmlpurifier

Using custom tags with HTMLPurifier


I want to use and tags as well as some custom tags (for example , ) with HTMLPurifier. I used

$config->set('HTML.Allowed','audio, video');

to add those tags but received warning that they are not standard and the tags are stripped out.


Solution

  • HTML Purifier doesn't support HTML5 yet, so that won't do. You can try to jerry-rig something with http://htmlpurifier.org/docs/enduser-customize.html but audio and video might be a bit fiddly to do correctly. Note also that even if audio and video were allowed, you're not allowing any attributes or other tags, which is probably not what you want.