Welcome! » Log In » Create A New Profile

HTML.TargetBlank not working

Posted by registrationsucks 
HTML.TargetBlank not working
April 05, 2017 03:06AM

I am unable to get HTML.TargetBlank working with the latest 4.9.2

I'm going to post some mismatched code from a wrapper class, it's not designed to be run but you'll get the idea

self::$config = HTMLPurifier_Config::createDefault();
self::$config->set('Core.Encoding', 'ISO-8859-1');
self::$config->set('HTML.Doctype', 'HTML 4.01 Transitional');
self::$config->set('Cache.DefinitionImpl', null);
self::$config->set('HTML.AllowedElements', array('a', 'b', 'br', 'em', 'i', 'img', 'li', 'ol', 'p', 'strike', 'strong', 'u', 'ul'));
self::$config->set('HTML.AllowedAttributes', array('a.href', 'a.target', 'img.alt', 'img.height', 'img.src', 'img.width', 'p.style'));
// sent to self::$config->set
array(
'URI.Base' => DOMAIN,
'URI.MakeAbsolute' => true,
'Attr.AllowedFrameTargets' => array('_blank'),
'HTML.TargetBlank' => true,
'AutoFormat.RemoveEmpty' => true
)

target="_blank" is never added.

Re: HTML.TargetBlank not working
April 05, 2017 11:53AM

Hi, was it working with previous versions?

Re: HTML.TargetBlank not working
April 06, 2017 11:38AM

No idea, wasn't using this feature before. This was upgraded from an old 4.0.0 though.

Re: HTML.TargetBlank not working
April 06, 2017 12:59PM

What happens if you remove the entries for HTML.AllowedElements and HTML.AllowedAttributes

Re: HTML.TargetBlank not working
April 06, 2017 10:43PM

It just scrubs out all the html.

Re: HTML.TargetBlank not working
April 07, 2017 01:07AM

Show me the updated code?

Re: HTML.TargetBlank not working
April 11, 2017 01:27AM

sorry for the delay, I'll make a standalone example here soon.

Sorry, you do not have permission to post/reply in this forum.