Solved

Style and script tags removed from HTML within RTE

  • 27 January 2023
  • 1 reply
  • 322 views

Hello,

We are currently experiencing challenges with preserving HTML code within our Rich Text Editor (RTE). Specifically, elements on our website that require CSS or JavaScript to be inserted into the HTML code section of the RTE, are causing issues. The code works as expected upon initial save, but when the page is edited, the RTE seems to strip out the ‘<style>’ or ‘<script>’ tags, resulting in plain text being displayed on the front-end.

We would greatly appreciate any assistance or insight into this problem.

Thank you,
Luke

icon

Best answer by Sachin 27 January 2023, 16:53

View original

1 reply

Userlevel 3

Hi Luke,

Thank you for your patience.

You need to enable the stack_variables by adding the sys_rte_allowed_tags in the request body of Add Stack settings API call. It will help you to retain the <style> and <script> tags in the HTML RTE.

Please refer the below documentation link for your reference.

https://www.contentstack.com/docs/developers/apis/content-management-api/#stack-settings

Regards,
Sachin.

Reply