AEM- How to make href to accept custom tel: tags ?

Avatar

Avatar

Veena_Vikram

MVP

Avatar

Veena_Vikram

MVP

Veena_Vikram
MVP

08-06-2020

Hi All

 

   I have a requirement where I need to add a property in the below format for a tel: attribute as phone number in a tag for RTE. Note :- tel: prefix is enabled in Day CQ Link Checker Service, so normal tel: numbers will work fine. 

 

format :- tel:${someproperty['value']} 

 

 The issues I am facing are below. 

Issue 1) I need to add something like above as the tel: value in the RTE . 

tel.JPG

 

 

 

 

 

When I add this, I need this to be visible in my href in the HTML. This works fine when I use @CONTEXT="unsafe" , but I don't want to go that route yet. It might be my last resort. 

While using @CONTEXT="unsafe" 

tel-unsafe.JPG

 

 

 

 

 

 

While using @CONTEXT='html'

tel-html.JPG

 

 

 

 

 

 

 

 

What I have done? 

 

1. Added the below regex to /apps/cq/xssprotection/config.xml

tel1.JPG

 

2. Added this to href attribute

tel2.JPG

Even restarted the instance . Still I am not getting the property rendered in the HTML. I might be missing something here. Any help is appreciated . 

 

TIA
Veena

 

 

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831
Arun_Patidar
MVP

08-06-2020

Hi Veena

It seems you are planning to read the value from resourceMap but It may not work because of encoded values stores in CRX. e.g. 

<p><a href="tel:${someproperty[&#39;value&#39;]}" target="Target">link</a></p>

you may be able to get through with XSS issue by changing xssconfig file or using context unsafe.

 

I would suggest writing a logic at backend java to decode tel URL and return the actual value along with text e.g. tel:+491520000000

 

 

Thanks

Arun

 

 

 

Answers (2)

Answers (2)

Avatar

Avatar

Nirmal_Jose

MVP

Avatar

Nirmal_Jose

MVP

Nirmal_Jose
MVP

08-06-2020

Have you tried adding htmlrules as a sibling to your rteplugin node.

 

 

<htmlRules jcr:primaryType="nt:unstructured">
 <links jcr:primaryType="nt:unstructured"
   ensureInternalLinkExt="{Boolean}false"
   protocols="[http://,https://,mailto:,tel:]"/>
 <docType jcr:primaryType="nt:unstructured">
   <typeConfig jcr:primaryType="nt:unstructured"
    useSemanticMarkup="{Boolean}true"/>
 </docType>
</htmlRules>

 

 

Avatar

Avatar

Nupur_Jain

MVP

Avatar

Nupur_Jain

MVP

Nupur_Jain
MVP

08-06-2020

Hi @Veena_Vikram 

 

Could you go to "Apache Sling XSS Filter" configuration using configMgr and open and save it

Once done, go to error.log file and check if there is any error related to XSS in updated rules from XSS file.