Jump to content

Welcome, Guest!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

  • 0
Theo

How to prevent Javascript code from being wrapped in CDATA? And "type" attribute being stripped from the script tag?

Question

Posted (edited)

Hi

How do I prevent / turn off CDATA wrapping of JS code? And also from stripping the "type" attribute from the script tag?

I've tried turning off HTMLPurifier, yet my JS code is still being wrapped by CDATA.
I need to turn this off as we've encountered issues with Google Console complaining about FAQ Schema code being wrapped in CDATA. If you unwrap the schema code from CDATA, then Google is happy.
Bytw this is from a CMS page (after implementing Vekia's TinyMCE enhancements to allow for script tag to be used on CMS page)
 

<script>// <![CDATA[
console.log("hello");
// ]]></script>

 

 

Edited by Theo

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

You can use solution outlined in this stackoverflow answer

To make it work in tb, edit file /js/admin/tinymce.inc.js and paste the code snippet into default_config:

image.thumb.png.a8b6f1577f0a3432081ef5941cb87bdf.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...