I have HTML Purifier configured and the following inthe allowed tags list:

"a[name|href|target]"

Cleared cache, and target is still stripped from links.

If I switch out to a filter without HTML Purifier formatting, target is not stripped.

Am I missing something? How can I allow this basic attribute?

Comments

kevinquillen’s picture

Title: target attribute being stripped from links » name/target attribute being stripped from links

Just noticed it also strips 'name'. href is the only attribute it will print.

Is this a module issue, or HTMLPurifier library issue?

kevinquillen’s picture

I edited the HTML Purifier module _htmlpurifier_get_config() and added:

$config->set('Attr.AllowedFrameTargets', array('_blank'));

To allow targets.

Is there a hook to allow a custom module to tell HTMLPUrifier module about config additions? I saw there was a config dir with sample.php, but is there a way (say, if HTMLPurifier module was updated tomorrow) to keep changes safe?

Additionally, I tried naming the sample file to 2.php (for format number) and function to _2 instead of _N, but it was not working. Where do you copy this file to?

ezyang’s picture

Status: Active » Closed (fixed)

You should use the Advanced HTML Purifier, which gives you more config settings on the page (the config directory is a last resort for special configs, and doesn't really work anyway.)

kevinquillen’s picture

Are you sayin the config folder/file/hook for htmlpurifier is non-functioning?

ñull’s picture

Category: bug » support
Status: Closed (fixed) » Active

Would be useful to indicate how to configure this in Advanced HTML Purifier. How do you add the allowed targets there?

ñull’s picture

Component: User interface » Documentation

In Advanced HTML Purifier you have to add _blank (and or other allowed targets) to the AllowedFrameTargets setting and target has to be among the AllowedAttributes.

Of course these kind of issues, that all users of WYSIWYG will come accross, could be mentioned somewhere, may be in a readme.txt?

heddn’s picture

Status: Active » Closed (works as designed)

Seems the original issue was resolved. Usability is being address in another issue: #925310: Configuration page should have inline examples