2

I am looking to allow data attr in tags with Redactor content.

What should I add to the Default config settings to allow this attr?

1

See this config setting: http://htmlpurifier.org/live/configdoc/plain.html#HTML.AllowedAttributes

You should be able to use it to allow data attributes.

  • Thanks Clark, I am aware of the settings, however when I try something like this "HTML.AllowedAttributes": ["img.src", "img.alt", "a.href", "*.title", "*.data"] I get an error saying Global attribute '*' is not supported in any elements. Even if i try to set the attr to an element, it still doesn't allow it Attribute 'data' in element 'a' not supported. I have also tried adding the HTML.AllowedElements setting too, to make sure the tag was allowed, but that made no difference. – zizther Sep 5 '19 at 9:20
  • Have you tried just .data or data – Clark Nelson Sep 5 '19 at 17:00
  • can confirm that using either ".data" or "data" will not work. – Chad W Oct 29 '19 at 15:05
1

Found this, which may help someone who is smarter than I am go down a path to solve this: https://stackoverflow.com/a/29317456/584599

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.