Solved

Universal HTML field with HREF, Target gets stripped?


Userlevel 5
Badge +16
  • Thinkwise Local Partner Brasil
  • 383 replies

Hi. We made a custom HTML field for a card list and it shows attachments. 

Some are too big to show inline and we want to give them a link. This works.. but for some reason the target predicate  get stripped with the result that the link doesn't open in a new tab/window.  

How can we solve this?  Deep linking to a preview component is not supported yet right? 

icon

Best answer by Leroy Witteveen 7 June 2022, 15:08

View original

This topic has been closed for comments

4 replies

Userlevel 3
Badge +3

Hi @Freddy,

Can you send an example HTML snippet in which the target attribute would be stripped?
If I insert the following HTML into the database and open it in Universal in a HTML control, it opens google.com in a new tab if I click the link:

<a href="https://google.com" target="_blank">Test</a>

I can also see in Chrome DevTools that it indeed stays intact:

 

Userlevel 5
Badge +16

Hi @Freddy,

Can you send an example HTML snippet in which the target attribute would be stripped?
If I insert the following HTML into the database and open it in Universal in a HTML control, it opens google.com in a new tab if I click the link:

<a href="https://google.com" target="_blank">Test</a>

I can also see in Chrome DevTools that it indeed stays intact:

 

Could it be that the card list behaves differently?

I get my attachments dynamically… with the TARGET mentioned. 

select pat.tenant_id
,pat.activity_id
,string_agg(iif(pat.attachment_type = 0
,'<a href="'+cf.s_url+'" target="_blank">'
+ '<img src="'+cf.s_url+'" height="80px" /></a>'
,'<ul><li><a href="'+cf.s_url+ '" target="_blank">'
+ pat.file_upload + '</a></li></ul>')
,'') as attachments
from process_attachment pat
left join csc_variable fu
on fu.variable_code = 'i_in_url_u'
cross apply ( select replace(replace(fu.variable_value,'[tenant_id]',pat.tenant_id),'[attachment_id]',pat.attachment_id) as s_url
) cf
group by pat.tenant_id
,pat.activity_id

and it gets stripped.:

 

Userlevel 3
Badge +3

Hi @Freddy,

I see the cardlist and grid indeed behave differently.
In the form, the target attribute actually first gets stripped too, but after that every link will receive target=”_blank” so URLs open in a new tab.
The same should probably be done for the cardlist and grid.
Could you create a ticket for this in TCP please?

Kind regards,
Leroy

Userlevel 5
Badge +16

Hi @Freddy,

I see the cardlist and grid indeed behave differently.
In the form, the target attribute actually first gets stripped too, but after that every link will receive target=”_blank” so URLs open in a new tab.
The same should probably be done for the cardlist and grid.
Could you create a ticket for this in TCP please?

Kind regards,
Leroy

Done 85345