The Tiny editor does not allow you to insert the script Topic is solved

General questions relating to Joomla! 4.x.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Post Reply
kosh2323
Joomla! Intern
Joomla! Intern
Posts: 84
Joined: Mon Aug 22, 2022 3:01 pm

The Tiny editor does not allow you to insert the script

Post by kosh2323 » Thu Jun 08, 2023 4:51 pm

The Tiny editor does not allow you to insert the script code into the HTML module, I select insert code in the editor itself, select the javascript script type, insert the code

Code: Select all

<script>
    alert( 'Hello, world!' );
  </script>
in the same form, it is displayed on the site. The <script> tag is not cut in the editor itself, it has been removed from prohibited elements in its settings. There are no filters in the superadmin settings either. Somewhere he still does not allow the script to execute. But it is worth disabling Tiny, and switching to the option "without an editor" or CodeMirror, the script works without problems. What could be the problem?

sozzled
I've been banned!
Posts: 13639
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Re: TinyMCE and <script> elements

Post by sozzled » Thu Jun 08, 2023 10:35 pm

This is a known issue with TinyMCE discussed here: viewtopic.php?f=808&t=995939.

kosh2323
Joomla! Intern
Joomla! Intern
Posts: 84
Joined: Mon Aug 22, 2022 3:01 pm

Re: TinyMCE and <script> elements

Post by kosh2323 » Fri Jun 09, 2023 6:40 am

sozzled wrote:
Thu Jun 08, 2023 10:35 pm
This is a known issue with TinyMCE discussed here: viewtopic.php?f=808&t=995939.
Thanks for the advice, I tried a way, you can connect the script by removing it from the prohibited ones and adding it to the allowed ones. But this option does not work with styles. It is strange that such an editor has limited capabilities and has to look for workarounds.

sozzled
I've been banned!
Posts: 13639
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Re: TinyMCE and <script> and <style> elements

Post by sozzled » Fri Jun 09, 2023 7:06 am

kosh2323 wrote:
Fri Jun 09, 2023 6:40 am
… you can [use <script> with TinyMCE] … but … not … styles.
Correct.This is a known limitation of TinyMCE: you can use <script> but you cannot use <style>.

You can use <script> and <style> with CodeMirror and some other editors (e.g. JCE Editor).

kosh2323
Joomla! Intern
Joomla! Intern
Posts: 84
Joined: Mon Aug 22, 2022 3:01 pm

Re: TinyMCE and <script> and <style> elements

Post by kosh2323 » Fri Jun 09, 2023 7:25 am

sozzled wrote:
Fri Jun 09, 2023 7:06 am
kosh2323 wrote:
Fri Jun 09, 2023 6:40 am
… you can [use <script> with TinyMCE] … but … not … styles.
Correct.This is a known limitation of TinyMCE: you can use <script> but you cannot use <style>.

You can use <script> and <style> with CodeMirror and some other editors (e.g. JCE Editor).
Thanks again for your help, sincerely.


Post Reply

Return to “General Questions/New to Joomla! 4.x”