<p>As you probably already know, Redactor removes any inline styling. <code>replaceDivs</code> doesn't appear to be in later versions of Redactor (at the least, it's not documented.)</p>

<p>Redactor will always remove Script tags, per the documentation. (I ran into this issue a few days ago.) Redactor supposedly has an option for this, but it doesn't appear to work in Craft, and has shaky documentation.</p>

<p>Here's the official Redactor documentation for it:</p>

<p><em>Using this setting with false argument, you can restrict use of script tag in your HTML. Redactor will automatically and always strip this tag form the code.</em></p>

<p>Here's the actual setting for Redactor:</p>

<p><code>script: false</code></p>

<p>I was able to get Redactor to allow script tags by removing that functionality from Redactor's core, but this should be considered a <em>very</em> temporary workaround until we can get someone from P&amp;T to add it, or clarification on the tag's proper use:</p>

<ol>
<li>Go to <code>craft/app/resources/lib/redactor/redactor.js</code> on line 193, and remove the 'script' tag from the array.</li>
<li>Comment out line 1980</li>
<li>Comment out line 2049</li>
<li>Comment out line 8006</li>
</ol>

<p>Again, <strong>this is <em>very</em> temporary until someone from P&amp;T can confirm proper tag functionality.</strong> You're modifying core, which is almost never a good thing.</p>

CC BY-SA 3.0
2015-10-22T14:15:33.750Z
2015-10-22T20:56:17.247Z
2015-10-22T20:56:17.247Z
Taylor Daughtry
<p>AFAIK this is still an issue with Craft 3. My solution was to create a new text field for the desired section called <code>templateFile</code>. Then I edited my page template so that whenever <code>templateFile</code> is non-empty, it will <code>{% include block.templateFile %}</code> instead of the usual content. </p>

<p>This allows me to bypass Redactor completely while restricting any generated <code>&lt;script&gt;</code> tags to templates, which requires access to the server files as well as the CMS. That keeps non-admin editors from accidentally including damaging code.</p>

CC BY-SA 4.0
2019-01-11T16:57:33.613Z
2019-01-11T16:57:33.613Z
Blazemonger
<p>Please do yourself a favor and <strong>don't do this  in Redactor</strong>. Find a solution with Matrix (and/or <a href="https://github.com/engram-design/SuperTable" rel="noreferrer">Super Table</a>) to add things like this in-between your text blocks.</p>

CC BY-SA 3.0
2015-10-22T14:22:46.780Z
2015-10-22T14:22:46.780Z
carlcs
<p>I wasn't to allow a user to enter html into the Rich Text field.</p>

<p>The html in question is: </p>

<pre><code>&lt;div class="issuuembed" style="width: 525px; height: 525px;" data-configid="7563847/30149275"&gt;&lt;/div&gt;
&lt;script src="//e.issuu.com/embed.js" async="true" type="text/javascript"&gt;&lt;/script&gt;
</code></pre>

<p>I can save the entry and on the front end the content displays ok - but when I go back in to edit the entry it is no longer there - the div and script tags have been removed.</p>

<p>I tried adding this </p>

<p>replaceDivs: false,</p>

<p>to the config but it doesn't make any difference</p>

<redactor><richtext>
Redactor stripping script/html tags
# Redactor stripping script/html tags

(Asked by: username_0 on 2015-10-22)

I wasn't to allow a user to enter html into the Rich Text field.
The html in question is: 



I can save the entry and on the front end the content displays ok - but when I go back in to edit the entry it is no longer there - the div and script tags have been removed.
I tried adding this 
replaceDivs: false,
to the config but it doesn't make any difference

**Tags:** redactor, richtext


---

## 3 answers

### Answer by username_3 on 2015-10-22. Score: 7 | Accepted answer

Please do yourself a favor and **don't do this in Redactor**. Find a solution with Matrix (and/or [Super Table](https://github.com/engram-design/SuperTable)) to add things like this in-between your text blocks.


---

### Answer by username_1 on 2015-10-22. Score: 3

As you probably already know, Redactor removes any inline styling. `replaceDivs` doesn't appear to be in later versions of Redactor (at the least, it's not documented.)

Redactor will always remove Script tags, per the documentation. (I ran into this issue a few days ago.) Redactor supposedly has an option for this, but it doesn't appear to work in Craft, and has shaky documentation.

Here's the official Redactor documentation for it:

*Using this setting with false argument, you can restrict use of script tag in your HTML. Redactor will automatically and always strip this tag form the code.*

Here's the actual setting for Redactor:

`script: false`

I was able to get Redactor to allow script tags by removing that functionality from Redactor's core, but this should be considered a *very* temporary workaround until we can get someone from P&T to add it, or clarification on the tag's proper use:

1. Go to `craft/app/resources/lib/redactor/redactor.js` on line 193, and remove the 'script' tag from the array.
2. Comment out line 1980
3. Comment out line 2049
4. Comment out line 8006

Again, **this is *very* temporary until someone from P&T can confirm proper tag functionality.** You're modifying core, which is almost never a good thing.


---

### Answer by username_2 on 2019-01-11. Score: 1

AFAIK this is still an issue with Craft 3. My solution was to create a new text field for the desired section called `templateFile`. Then I edited my page template so that whenever `templateFile` is non-empty, it will `{% include block.templateFile %}` instead of the usual content.

This allows me to bypass Redactor completely while restricting any generated


---

