Script issue with RTE | Community
Skip to main content
Syeda_Yasmeen_B
April 4, 2018

Script issue with RTE

  • April 4, 2018
  • 4 replies
  • 8064 views

In AEM 6.3 script tag is not getting saved when configured via RTE.

Below are the observations we noticed

1.If we tried giving <script></script> in source edit and come back to normal view within dialog before closing, script is removed,

this is fixed by doing changes in whitespaceprocessor.js by removing script

2. On click of dialog save, values are not getting retained in jcr:content node. script tag is getting removed.

And also src attribute for img tag is getting removed for few url's

below are the steps which helps us to solve few issues

1.We overlayed /apps/cq/xssprotection/config.xml which solves issue by adding required url.

2. This works only for few scenarios and fails if we are trying to use below img src tag

<img class='avia_image ' src='https://s3.amazonaws.com/cision-wp-files/us/wp-content/uploads/2018/03/12155415/marketing_content_2.png' alt='' title='marketing_content_2' itemprop="contentURL"  />

Help is Appreciated !!

Thanks

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

4 replies

smacdonald2008
April 4, 2018

I am not following what you are trying to do. Are you following Adobe documentation when modifying the RTE like this., Can you ponit the community to the doc so this can be reproduced.

Syeda_Yasmeen_B
April 4, 2018

We are using the standard OOTB component and just trying to add an HTML which contains a script tag , On saving the Dialog, the script tag and entire content within the script is getting stripped of , leaving only with HTML.

Does this answer to your query?

smacdonald2008
April 4, 2018

I am concerned when you say you have to modify whitespaceprocessor.js. As far as i know - there are no AEM instructions prompting you to modify this JS file.

If there are - can you point me there.

kautuk_sahni
Community Manager
Community Manager
April 6, 2018

Similar thread:-

Kautuk Sahni
Pablo_Larrosa-R
August 13, 2018

hi Syeda ,

You were able to solve this ??

I'm running into the same issue that the RTE is removing the src attribute from the <img> tag

arunpatidar
Community Advisor
Community Advisor
August 14, 2018

Hi,

You can check /libs/cq/xssprotection/config.xml for img tag valid rules.

Thanks
Arun

Arun Patidar
Pablo_Larrosa-R
August 14, 2018

Thanks Arun,

For the img tag inside the RTE wasn't a missing configuration inside the /libs/cq/xssprotection/config.xml

It was the /libs/clientlibs/granite/richtext/core/js/HtmlSerializer.js the one stripping out the src attribute from the img tag.

November 17, 2023

I found that adding _rte_src="your_url" in addition to src="your_url" keeps your src attribute from getting stripped and becoming null after saving your rte.