Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html5 <video> tag support #106

Open
chemel opened this issue Dec 10, 2016 · 10 comments
Open

html5 <video> tag support #106

chemel opened this issue Dec 10, 2016 · 10 comments

Comments

@chemel
Copy link

chemel commented Dec 10, 2016

htmlpurifier remove the video tag, could you allow this tag?

Maybe you can draw inspiration from this piece of code: https://github.com/kennberg/php-htmlpurfier-html5/blob/master/htmlpurifier_html5.php#L59

Related issue: Exercise/HTMLPurifierBundle#34

Thanks for this geat lib.

@ezyang
Copy link
Owner

ezyang commented Mar 8, 2017

Yes, in principle we should accept this tag, but we'll need to carefully audit it for XSS possibilities. People who want to live dangerously can perhaps just add video manually for now.

@Global90
Copy link

Global90 commented May 1, 2017

how to add video manually?? i use in Yii2

@jackewitz
Copy link

We just try to allow video-tags in limesurvey using htmlpurifier to prevent XSS-attacks. So the question above is highly responsible for us. Is there an answer to "how to add video manually"?

@ezyang
Copy link
Owner

ezyang commented Jul 6, 2017

For a hacky but probably will work solution, look at http://htmlpurifier.org/docs/enduser-youtube.html

If you want to support it as a proper tag, look at http://htmlpurifier.org/docs/enduser-customize.html

@jackewitz
Copy link

Thanks for your reply. Unfortunately: LimeSurvey use an array to configure htmlpurifier. Is it possible to add video tag via the configuration array (not via the configuration object)?

We tried it with

  • HTML.Allowed
  • HTML.AllowedElements and HTML.AllowedAttributes

but nothing works.

@lj3lj3
Copy link

lj3lj3 commented May 22, 2018

I just follow the enduser-customize.html and use bellow code, video tag works as expected! Maybe need to improve the some parameter. hope it helps.

$def = $htmlPurifierConfig->getHTMLDefinition(true);
$def->addElement(   // add video tag
    'video',   // name
    'Block',  // content set
    'Flow', // allowed children
    'Common', // attribute collection
    array( // attributes
        'src' => 'URI',
        'width' => 'Length',
        'height' => 'Length',
        'style' => 'CDATA'
    )
);

$purifier = new HTMLPurifier($htmlPurifierConfig);

@mattford
Copy link

mattford commented Jun 7, 2018

https://github.com/xemlock/htmlpurifier-html5 adds HTML5 definitions to this lib

@mbnoimi
Copy link

mbnoimi commented Jul 29, 2022

Is there still any hope to implement this feature request soon? I haven't the proper experience to contribute the code but I found it a vital thing in 2022
I faced a problem with it in this post

@bytestream
Copy link
Contributor

@mbnoimi it's implemented in https://github.com/xemlock/htmlpurifier-html5

@mbnoimi
Copy link

mbnoimi commented Jul 30, 2022

@mbnoimi it's implemented in https://github.com/xemlock/htmlpurifier-html5

Sorry for my mistake. I didn't notice that this repository doesn't belong to NextCloud (I came from this discussion)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants