Reputation: 6587
I'm using HTMLPurifier and even thou I have :
$config->set('HTML.Doctype', 'XHTML 1.0 Transitional');
it removes all 'target' attribues from the links.
Any idea why is it doing it?
Upvotes: 16
Views: 6312
Reputation: 11
In a Yii2 application, inside of a DetailView, I configured HtmlPurifier as follows:
[
'label' => 'Document PDF',
'format'=> 'raw',
'value' => HtmlPurifier::process(DocumentFunctions::viewDocumentPdfInView($model->document_id), [
'Attr.AllowedFrameTargets' => ['_blank'],
]),
],
Here is a simpler way I found:
[
'label' => 'Document PDF',
'format'=> ['html', 'config' => ['Attr.AllowedFrameTargets' => ['_blank']]],
'value' => DocumentFunctions::viewDocumentPdfInView($model->document_id),
]
Upvotes: 1
Reputation: 4382
The list of allowed frame targets is not enabled by default. You have to enable it manually.
Upvotes: 31