There may be times when you want to add <script> tags to an article or module. By default and for security reasons, Joomla's TinyMCE editor does not allow <script> tags to be placed in the content area of Articles, Categories or Modules. You also need to change some settings in JCE Editor (if you are using that extension) to allow using <script> tags. Adding Advertisements on your site from Google, Bing, etc, often requires that you place <script> tags in the content area.

Set the Global Configuration to allow JavaScript

Go to the Global Configuration area under the System dropdown. Click on the Text Filters tab. For the User Groups that will be adding content that might need <script> tags, change (or verify) the setting to No Filtering. For security reasons, only change the User Groups necessary. Do not allow just any user to add <script> tags - it could cause trouble. Click Save & Close if you make any changes.


Enabling JavaScript in TinyMCE

Screenshot to Prohibited Elements option for TinyMCE Editor

Plugin Manager: go into the Plugin Manager under the Extensions dropdown menu. It the search box, type in TinyMCE. This should show the Editor - TinyMCE plugin. Click on the plugin name to open up the settings for the plugin.

In the Plugin tab, towards the bottom is a list of Prohibited Elements. Remove the word script (and the comma) from the list in the text box.

Save & Close after making this change.

Entering <script> tags into TinyMCE Text Editor

tinymce-toggleeditor

When you are creating or editing an Article or Module and you want to add a <script> tag, you need to toggle the editor to view straight HTML. Click on the Toggle Editor button. Place your <script>....</script> information into the text box.

Note: If you then toggle the editor back into the text processing screen, you will not see anything in the editor for the <script> tag. Toggle back and forth to be sure it is still there. Save the article and toggle again. If the text editor is allowing <script> tags, this code will still be there. If it is stripping out the <script> tags, then there is still some setting that has not been changed for your Joomla installation.


Enabling JavaScript tags with JCE Editor

jce-allowjavascript

If you are using JCE Editor as your text editor, you need to take some other steps. The changes need to be made in the Global Configuration area for JCE Editor. Pull down the Components dropdown menu and click on JCE Editor.

Click on the Editor Profiles icon. There will be a list of the Profiles set up for the different users. The Default profile will be the settings applied to all users. If you have Front End enabled, you can make changes to the settings for just those individuals that are allowed to add content to the Front End. For security purposes, you likely don't want to have Front End users able to add <script> tags. We suggest that you enable the Front End profile so that you can be sure this area will not allow the addition of <script> tags into content.

You can also copy the Default profile, rename it for a unique profile for those editing the site, and make changes in there for just these certain people. You will need be sure that they are in the User Groups listed.

Click on Default profile, or the profile that you had set up, and click on the Editor Parameter tab. Click on Advanced. Click on the radio button for Yes to Allow JavaScript.

Save & Close the JCE Administration screen.

Entering <script> tags with JCE Editor

When you go to edit an Article or Module, you need to toggle the text editor screen to enter the <script>...</script> code. If you toggle the text editor again, you will see a small icon to indicate that there has been some <script> added. You will not see the code itself. If you save the article, the <script> should stay. You can toggle the editor back to HTML mode to be sure the <script> is still there. If it has been stripped out, then there is still some setting in your Joomla installation that need to be changed.