Q: TinyMCE - Why can't I use the script or iframe tag, e.g. for embedding a youtube video in an article?

A: By default, Joomla's builtin TinyMCE Editor filters out some tags like script and iframe. To use these tags, you need to edit TinyMCE's configuration.

Maybe this has also happened to you: You want to embed a youtube video using the embed code that you can copy from the official youtube site into your Joomla article.
You're using the default Joomla editor (TinyMCE), but if you paste the embed code to your article and save your article, the embed code gets removed.
The same happens if you want to load a JavaScript file in your article using the script tag.

Now you wonder why this happens.

The answer is simple - Joomla's TinyMCE removes these tags by default.
However, there is a possibility to change this behaviour and to use script and iframe tags in your article.
Follow this howto to do so.

First, go to your plugins by clicking Extensions->Plugins in the Joomla backend.
Then filter your plugins for the Type 'editors' - you should now see only 3 entries (editor - none, editor - codemirror and editor - tinymce).
Click the plugin called 'Editor - TinyMCE' to edit its configuration.

In the configuration, find the field labelled 'Prohibited Elements'.
By default, this textbox will contain "script,applet,iframe" , which means that you cannot use these tags in the TinyMCE editor.
If you want to be able to use the script and iframe tags in your articles using the TinyMCE editor, you should remove them from this list.
You can also remove the "applet"* tag. "applet" is being used for Java applets only, but you should use the object tag instead in HTML5.

* Note, "applet" is a HTML 4/XHTML element and is marked as deprecated in HTML5

When done, click the save button to save the plugin's configuration.

Next, edit your article again and paste your embed code or your JavaScript into the article and save your article.
(Maybe you need to activate the source code view to paste the tags.)

After saving, these tags should no longer be removed, and your video should be displayed in the frontend, or your script should be loaded and executed.

2024-11-06