Jump to content
thirty bees forum
  • 0

[Solved] How to prevent Javascript code from being wrapped in CDATA?


Question

Posted (edited)

Hi

How do I prevent / turn off CDATA wrapping of JS code? 

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

3 answers to this question

Recommended Posts

  • 0
Posted (edited)
On 10/9/2019 at 5:59 PM, datakick said:

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

Thanks. Now to stop it from stripping out the type attribute <script type="javascript/text"> ...
lol

Edited by Theo
  • 0
Posted (edited)

The original question had a second part on how to prevent TinyMCE from stripping the type attribute from the Script Tag.
I've created a post for this one specifically:

 

Edited by Theo

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...