htmlpurifier - Laravel Package Purifer not work with iframe -


it seems after adding config params enable youtube , vimeo iframes still exception error. "element 'iframe' not supported[..]"

return array(    'encoding' => 'utf-8',        'finalize' => true,        'preload'  => false,        'settings' => array(        'default' => array(               'html.doctype'             => 'xhtml 1.0 strict',               'html.allowed'             => 'blockquote,div,b,strong,i,em,a[href|title],ul,ol,li,p[style],br,span[style],img[width|height|alt|src]',               'css.allowedproperties'    => 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align',               "html.safeiframe"          => 'true',               "uri.safeiframeregexp"     => "%^(http://|https://|//)(www.youtube.com/embed/|player.vimeo.com/video/|api.soundcloud.com/tracks/)%",         'autoformat.autoparagraph' => true,         'autoformat.removeempty'   => true,     ), ), 

your issue using doctype xhtml 1.0 strict. in documentation of html.safeiframe stated that:

whether or not permit iframe tags in untrusted documents. directive must accompanied whitelist of permitted iframes, such %uri.safeiframeregexp, otherwise fatally error. this directive has no effect on strict doctypes, iframes not valid.

so should use transitional instead. following configuration work correctly:

return array(     'encoding' => 'utf-8',     'finalize' => true,     'preload'  => false,     'settings' => array(         'default' => array(             'html.doctype'             => 'xhtml 1.0 transitional',             'html.allowed'             => 'iframe[src|width|height|class|frameborder],blockquote,div,b,strong,i,em,a[href|title],ul,ol,li,p[style],br,span[style],img[width|height|alt|src]',             'css.allowedproperties'    => 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align',             "html.safeiframe"          => true,             "uri.safeiframeregexp"     => "%^(http://|https://|//)(www.youtube.com/embed/|player.vimeo.com/video/|api.soundcloud.com/tracks/)%",             'autoformat.autoparagraph' => true,             'autoformat.removeempty'   => true,         ),     ), ); 

Comments

Post a Comment

Popular posts from this blog

c# - must be a non-abstract type with a public parameterless constructor in redis -

c# - ReportViewer control - axd url -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -