I am running ExpressionEngine 2.5.3. Happens something weird: when I save a template from the admin panel, javascript tags in it gets transformed from <script> to [removed]. I have checked file permission, configuration etc, but I can't figure out why this happens.

  • Perhaps a bit more detail. What type of template are they being stripped from: Web Page, Javascript, CSS, Static, etc. Is anything else being removed? Is it just a reference to the javascript file or the full javascript? Mar 28, 2013 at 0:16
  • the template it's a regular Web Page one, no PHP enabled. The tag stripped it's a full JavaScript, and this happens only if I save the file from the admin. I hope that helps.
    – Mimo
    Mar 28, 2013 at 0:35

2 Answers 2


I've seen this happen when the server was doing some aggressive security stripping. Modifying the template via FTP didn't show the issue; only submitting via the CP. So I'd talk to your host about it; and also try via FTP and make sure that works as expected. :)

  • Thank you Lisa, look like the problem it's with the hosting. I can't upvote your reply unfortunately.
    – Mimo
    Mar 28, 2013 at 2:23

If it's full javascript, you're using the wrong template type. While the web page template type will handle references to javascript files, such as

<script type="text/javascript" src="/javascripts/modernizr.foundation.js"></script>
<script src="/javascripts/lib/selectivizr.js?1337120337" type="text/javascript"></script>

the javascript file-type is preferred for actual javascript. Read, 'Are There Limitations on ExpressionEngine's Javascript Handling?' question by Steve Hurst. The web page template doesn't always protect javascript, so it's frequently better to reference the script and store outside of EE or on the javascript file type. But another option, which may work is to modify the config.php file to add the hidden variable:

$config['protect_javascript'] = 'y';

ExpressionEngine has a number of, not needed frequently, but available for use variables, see Hidden Variables.

One of these should work, assuming there wasn't some odd bug in EE 2.5.3. Is there a reason you haven't updated to 2.5.5? You may also want to upgrade.

  • I haven't update yet but I'll do next month. The template it's not a full javascript, the template it's a regular one with some javascript code in it, (G+, Facebook and Twitter).
    – Mimo
    Mar 28, 2013 at 1:02
  • Try the protect JavaScript option. Mar 28, 2013 at 1:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.